Caesar Cipher
Shift every letter of a message by a fixed number of places to encode it, or shift it back to decode it. Don't know the key? The brute-force table tries all 25 shifts and ranks them by how much the result looks like English.
All 25 shifts, most likely first
| Rank | Shift | Decoded text | English score |
|---|
Letter frequency
your text (input)typical English
How to use the Caesar Cipher
- Choose Encode or Decode at the top.
- Type or paste your text and set the shift (key). ROT13 and Shift 3 are one click away.
- Press Encode or Decode (the output also updates as you type) and copy the result.
- Crack an unknown message: press Brute-force All Shifts. The most likely plaintext is listed first; click Use to adopt that key.
- Check the frequency chart to see why a shift was chosen: English text peaks at E, T, A and O.
Caesar cipher formula
Number the letters A = 0, B = 1 … Z = 25. With a key k:
- Encrypt: E(x) = (x + k) mod 26
- Decrypt: D(x) = (x − k) mod 26
Worked example with k = 3: H (7) → (7 + 3) mod 26 = 10 = K; E → H; L → O; O → R. So HELLO becomes KHOOR. For Y (24): (24 + 3) mod 26 = 1 = B, which is how the alphabet wraps around. A negative key shifts the other way: decoding with key 3 is the same as encoding with key −3 or 23.
Shift table for a key of 3
| Plain | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cipher | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
How the brute force ranks the 25 shifts
For every key from 1 to 25 the tool decodes the text and scores the result:
- Letter frequencies. English uses E (12.7%), T (9.1%), A (8.2%) and O (7.5%) most and J, Q, X and Z least. The score adds up the log-probability of every letter, and the table also shows a chi-squared value: χ² = Σ (observed − expected)² ÷ expected.
- Common words. The share of letters that form words like the, and, of, to, is, you.
- Common trigrams such as THE, ING, AND and ION, which also work when the text has no spaces.
Example: Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj decodes with key 3 to "The quick brown fox jumps over the lazy dog", which wins clearly because it contains the words the and over and has a natural letter mix. Texts shorter than about a dozen letters can be ambiguous, so check the next few rows too.
Variants of the shift cipher
| Name | What it shifts | How to get it here |
|---|---|---|
| Caesar (classic) | Letters by 3 | Preset “Caesar (3)” |
| ROT13 | Letters by 13 (self-inverse) | Preset “ROT13” |
| ROT1 | Letters by 1 (A→B) | Preset “ROT1” |
| Digit shift | 0–9 by the key modulo 10 (key 5 = ROT5 on digits) | Tick “Also shift digits” |
| Vigenère | Each letter by a different key letter | A Caesar cipher per position; not covered by this tool |
Frequently asked questions
What is a Caesar cipher?
A substitution cipher in which each letter is replaced by the letter a fixed number of positions further down the alphabet, wrapping from Z back to A. Julius Caesar reportedly used a shift of 3, so A becomes D and HELLO becomes KHOOR.
How do I decode a Caesar cipher without the key?
There are only 25 possible keys, so try them all. The brute-force table does this instantly and ranks each result by how English it looks, using letter frequencies and common words. For a sentence or more, the correct key is almost always at the top.
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 text, so the same operation encodes and decodes. It is used to hide spoilers and puzzle answers, not for security.
Is the Caesar cipher secure?
No. With only 25 keys it can be broken by hand in minutes and by a computer instantly. It is useful for teaching, puzzles, escape rooms and geocaching, but never for protecting real information.
What happens to numbers, spaces and punctuation?
They are left unchanged, and the case of every letter is preserved. Tick “Also shift digits” to rotate 0–9 by the shift as well (modulo 10), which some puzzles use.
How does the English score work?
Each candidate is scored by comparing its letter frequencies with English (a chi-squared test) and by counting common English words such as the, and, of and to. The percentages show how the 25 candidates compare with each other.