About the Caesar Cipher Encoder/Decoder
This Caesar cipher tool encodes and decodes messages that use a simple letter shift. Each letter is moved a fixed number of places along the alphabet — with a shift of 3, A becomes D, B becomes E and Z wraps around to C — while numbers, spaces and punctuation stay as they are and upper- and lowercase are preserved. ROT13, the shift of 13 popular for hiding spoilers and puzzle answers, is built in.
It is made for students learning classical cryptography, puzzle and geocache solvers, escape-room designers and teachers. If you do not know the key, the brute-force table shows the message under all 25 possible shifts, and the tool scores each one against normal English letter frequencies to pick the most likely plaintext automatically.
A Caesar cipher offers no real security: there are only 25 keys, so anyone can try them all in seconds, exactly as this page does. Use it for fun, teaching and puzzles, never for passwords or private information.
How to use the caesar cipher encoder/decoder
- 1Type or paste your message.
- 2Choose Encode, Decode, ROT13 or Crack automatically.
- 3For encode or decode, set the shift key (3 is the classic Caesar shift).
- 4Copy the result, or scan the brute-force table to read every possible decoding.
Formula and method
Each letter is numbered A = 0 to Z = 25. Encoding adds the key k and wraps around with modulo 26, so with k = 3, X (23) becomes (23 + 3) mod 26 = 0 = A. Decoding subtracts the key, which is the same as encoding with 26 − k. ROT13 uses k = 13, which is its own inverse: applying it twice returns the original text. Case is kept and non-letters are left untouched.
To crack an unknown key, the tool decodes the text with all 25 keys and compares the letter counts of each attempt (Oᵢ) with the counts expected from typical English letter frequencies (Eᵢ = letters × frequency of letter i). The attempt with the smallest chi-squared statistic is the most English-like and is reported as the best guess. This works well on a sentence or more, but can misfire on a handful of letters.
- x
- Letter position, A = 0 … Z = 25
- k
- Shift key, 1–25
- Oᵢ, Eᵢ
- Observed and expected count of letter i
Worked examples
Classic shift of 3
Each letter moves three places forward: H→K, e→h, l→o, o→r, W→Z, r→u, d→g. The comma, space and exclamation mark are unchanged and capitals stay capitals, giving "Khoor, Zruog!".
ROT13 a spoiler
ROT13 shifts every letter by 13, half the alphabet, so W→J, h→u, y→l and so on. Running the result through ROT13 again moves each letter another 13 places, back to the original question.
Cracking an unknown key
The tool decodes the message with all 25 keys and scores each attempt with a chi-squared test against English letter frequencies. Shifting back by 3 (forward by 23) gives the lowest score, revealing the pangram "The quick brown fox jumps over the lazy dog".
Frequently asked questions
How does a Caesar cipher work?+
Every letter is replaced by the letter a fixed number of places further along the alphabet, wrapping from Z back to A. With a shift of 3, "ABC" becomes "DEF" and "XYZ" becomes "ABC". The recipient shifts back by the same amount.
What is ROT13?+
ROT13 is a Caesar cipher with a shift of 13. Because the alphabet has 26 letters, applying ROT13 twice gives back the original, so the same operation both encodes and decodes. It is used to hide spoilers and puzzle answers, not to keep secrets.
How do you decode a Caesar cipher without the key?+
Try all 25 shifts and look for readable text, or use frequency analysis: in English, E, T and A are the most common letters. This tool does both, ranking every shift by how closely its letter counts match English.
Is the Caesar cipher secure?+
No. There are only 25 possible keys, so it can be broken by hand in minutes and by a computer instantly. Modern encryption such as AES uses keys with 2^128 or more possibilities.
What shift did Julius Caesar use?+
According to the Roman historian Suetonius, Julius Caesar shifted letters three places, writing D for A. Suetonius also reports that Augustus used a shift of one, writing B for A.