Free Tool
Caesar Cipher Simulator
The Caesar cipher is the oldest cipher most people meet: shift each letter a fixed number of places, and A becomes D. It is simple, it is satisfying — and it is trivially breakable, because there are only 25 possible shifts. Try it below, then break it the same way an attacker would.
A learning toy, never real security. The Caesar cipher can be broken by hand in a minute, and anything it scrambles can be read by anyone who tries all 25 shifts. Use it to learn how ciphers fail — never to protect a real message.
What this tool does
Julius Caesar reportedly used this cipher to protect military messages: each letter of the message was shifted three places forward in the alphabet, so A became D, B became E, and so on, wrapping around at the end. The shift — the key — was shared between sender and receiver, and anyone who knew it could read the message. In a world where most people could not read at all, and where there were no computers, that was enough. It has not been enough for a very long time.
This simulator lets you encrypt and decrypt with any shift from 1 to 25, and, crucially, it lets you break a Caesar message by trying all 25 shifts at once. That is the whole attack: 25 tries, and one of them reads as English. The simulator shows every shift side by side, so you can see the message emerge from the noise, and you can feel for yourself why a cipher with 25 keys is not security but a puzzle.
The Caesar cipher is worth learning anyway, because it teaches the ideas that all ciphers share: a key, an encryption step, a decryption step, and an attack that tries every key. Modern ciphers work the same way in outline — the difference is the size of the key space. A modern cipher has so many possible keys that trying them all would take longer than the age of the universe. Caesar has 25. The gap between those two numbers is the whole history of cryptography, and this page lets you stand on one side of it and look at the other.
Try it
Type a message, choose a shift, and encrypt or decrypt it. Then break a message by showing all 25 shifts.
Waiting. Type a message and choose Encrypt, Decrypt, or Break it.
All 25 shifts:
How it works
Encryption shifts each letter forward by the key: with a shift of 3, A becomes D, B becomes E, and Z wraps around to C. Lower-case and upper-case letters are shifted separately, so the case of the message is preserved, and anything that is not a letter — a space, a number, a punctuation mark — is left exactly as it is. Decryption shifts each letter backwards by the same amount, reversing the process exactly. The key is the shift itself, a number from 1 to 25; a shift of 0 would change nothing, and a shift of 26 is the same as 0, so there are only 25 distinct keys.
Breaking the cipher needs no cleverness at all. There are only 25 keys, so an attacker tries all of them and looks at the results. Twenty-four of them will be gibberish; one will read as English. The simulator's break button does the same thing in a fraction of a second, which is why frequency analysis — the classic technique for breaking substitution ciphers — is overkill here. The weakness is not in the details of the cipher but in its size: 25 keys is a number a child can count through.
The lesson generalises. A cipher's strength depends on the size of its key space and on the absence of shortcuts that let an attacker do better than trying every key. Modern ciphers use keys of 128 or 256 bits, which means about 340 trillion trillion trillion possible keys — a number so large that no computer, however fast, could try them all. Caesar, with 25, is the opposite end of that scale, and it exists on this site so you can feel the difference rather than just reading about it.
Limitations
The Caesar cipher is a toy. Anything encrypted with it can be read by anyone who tries all 25 shifts, which is everyone who finds the message. It must never be used to protect a real message, a password, or any information that matters. It is included on this site as a teaching tool, and the ROT13 encoder is its even simpler cousin — a Caesar cipher with a fixed shift of 13.
- The simulator shifts letters only. Numbers, punctuation and spaces pass through unchanged, which is how the historical cipher worked — and another reason it is weak.
- Breaking a Caesar message by trying all shifts works when the message is long enough to recognise as English. A very short message may be ambiguous, but that is not security — it is obscurity.
- Nothing you type is sent anywhere. The computation is local, and the page works offline once loaded.
Examples
Example 1 — Attack at dawn, shift 3. Encrypt Attack at dawn with a shift of 3 and you get Dwwdfn dw gdzq. Decrypt it with the same shift and you get the message back. The capital A shifts to D and the lower-case letters shift the same way, while the spaces stay where they are.
Example 2 — breaking it. Take Dwwdfn dw gdzq and press Break it. All 25 shifts appear, and shift 23 — which is the same as shifting back by 3 — reads Attack at dawn. The other 24 are gibberish. That is the entire attack, and it takes a human a few seconds.
Example 3 — why shift 13 is special. ROT13 is a Caesar cipher with a shift of 13, and 13 is half of 26 — so encrypting twice with ROT13 gives you the original back. That is why ROT13 is used to hide spoilers and puzzle answers rather than secrets: it is a Caesar cipher with a fixed key, and it is broken by definition.
Frequently asked questions
How does the Caesar cipher work?
Each letter is shifted a fixed number of places through the alphabet. With a shift of 3, A becomes D, B becomes E, and Z wraps to C. The shift is the key, and the receiver shifts backwards by the same amount to read the message.
Why is the Caesar cipher insecure?
Because it has only 25 possible keys. An attacker tries all 25 and picks the one that reads as English — a few seconds of work. A secure cipher needs a key space so large that trying every key is not feasible.
Did Julius Caesar really use this cipher?
According to the Roman historian Suetonius, Caesar used a shift of 3 for military messages. In a world without computers and with low literacy, that was enough. It has not been enough for centuries.
What is the difference between Caesar and ROT13?
ROT13 is a Caesar cipher with a fixed shift of 13. Because 13 is half of 26, encrypting twice returns the original — so the same operation both encodes and decodes. It is used for hiding spoilers, not secrets.
Can a short Caesar message be secure?
No. A short message is only harder to recognise, not harder to break — an attacker still only has 25 shifts to try. Obscurity is not security, and a short message encrypted with Caesar is still readable by anyone who tries.