Caesar Cipher Encoder / Decoder
Encode or decode with any shift from 1 to 25 — or crack a message with no key by listing every shift at once.
- Plain text
- Attack at dawn
- Key
- shift 3
- Encoded
- Dwwdfn dw gdzq
Not knowing the shift, the first rows of the brute-force list for that encoded text are:
- 1 Cvvcem cv fcyp
- 2 Buubdl bu ebxo
- 3 Attack at dawn
- 4 Zsszbj zs czvm
Other ciphers
How the Caesar cipher works
Every letter is moved the same number of places along the alphabet, wrapping from Z back to A. That number — the shift — is the whole key. With a shift of 3, A becomes D, B becomes E, and X, Y and Z wrap round to A, B and C. Decoding moves each letter back by the same amount.
Suetonius records Julius Caesar writing to his generals with a shift of three, and Augustus using a shift of one. ROT13 is the same cipher with the shift fixed at 13.
A worked example
With a shift of 3, Attack at dawn becomes Dwwdfn dw gdzq. Case, spaces and punctuation are left alone, which is also the first thing that gives the cipher away: the word lengths of the original survive.
How it is broken
There are only 25 possible shifts, so the reliable attack is not cleverness but patience: try every one. Turn on try all 25 shifts above and the tool lists the message under each; exactly one row reads as English. That took a codebreaker a few minutes with a pencil, and it is why the cipher protects nothing.
The older attack is frequency analysis, first written down by al-Kindi in the ninth century. In English text E is the most common letter, so the most common letter in a long Caesar ciphertext is very likely E shifted — and that one guess gives away the shift for the whole message.
Everything on this page runs in your browser — nothing you type is sent anywhere. The cipher encoder / decoder runs all five ciphers on one page, and the cipher buttons above switch this one too.
How do I decode a Caesar cipher without the key?
Turn on "try all 25 shifts" above. Every possible shift is listed at once, and the one that reads as English is the answer. With only 25 keys this always works.
What shift did Julius Caesar use?
Three, according to Suetonius: each letter was replaced by the one three places later. The tool opens at a shift of 3 for that reason.
Is a shift of 13 special?
Yes — a shift of 13 is ROT13, and because 13 is half of 26 it is the one shift where encoding and decoding are the same operation.