They mean the same thing. Can't is the contraction and belongs in speech and ordinary writing; cannot is the full form and reads more formal or more emphatic. Note that cannot is one word — "can not" as two words means something different, and is almost never what you want.
The core difference
There is no difference in meaning. Can't is simply cannot with the letters removed and an apostrophe marking the gap. The choice is register, and occasionally emphasis.
- can't — speech, dialogue, ordinary prose, anything with a conversational tone
- cannot — formal writing, legal and technical text, or when you want the weight: "This cannot happen again."
The rule that does matter: one word, not two
Cannot is written as a single word. Can not, spaced, is a different construction and means "it is possible not to" — it only appears in sentences like "You can not go, if you prefer", where the not belongs to what follows rather than to can. That is rare, and if you did not intend it, close the word up.
Where the apostrophe goes
The apostrophe replaces the missing letters, so it sits between the n and the t: can't. Not ca'nt, and never cant without one — cant is its own word meaning insincere or hypocritical talk, which is why the spellchecker will not always catch it.
Which to write
Match the surrounding tone. A contract, a policy or a formal report reads better with cannot; almost everything else reads stiff without can't. Neither is more correct, and no style guide bans contractions outright any more.
Frequently asked questions
Is "cannot" one word or two?
One word. "Can not" as two words means "it is possible not to" and is rarely what a writer intends.
Is "can't" too informal for professional writing?
No. Contractions are standard in most professional prose. Reserve cannot for formal, legal or emphatic contexts.
What is "cant" without an apostrophe?
A real but separate word meaning insincere or pious talk, as in political cant. That is why a spellchecker will not always flag a missing apostrophe.