How to use it
- Choose Encrypt to hide a message or Decrypt to read one. The sample text is "Hello, World!" with a shift of 3.
- Set the shift with the slider, from 0 to 25. If you do not know the shift, leave it and go to step 4.
- Paste or type your text. The result updates as you type, and case, spaces, digits and punctuation are kept as they are.
- Open the brute force table to see all 25 shifts side by side. With at least a dozen letters the most English-looking row is highlighted.
How the Caesar cipher works
The Caesar cipher is a substitution cipher with one setting: the shift. Pick a number from 1 to 25. Replace every letter with the letter that many places further along the alphabet. When you run past Z, you wrap around to A.
With a shift of 3, A becomes D, B becomes E, and X, Y, Z become A, B, C. The plain alphabet and the cipher alphabet look like this:
| 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 |
|---|---|
| Shift 3 | 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 |
To decode, you slide the other way. The tool above does both. Choose Decrypt and it moves each letter backward by the shift you set.
Caesar cipher formula
Number the letters from A=0 to Z=25. If x is a letter's position and n is the shift:
encrypt: (x + n) mod 26decrypt: (x - n) mod 26
The "mod 26" part is the wrap-around. Take H, which is 7, with n = 3. Then 7 + 3 = 10, and position 10 is K. Take Y, which is 24: 24 + 3 = 27, and 27 mod 26 = 1, so Y becomes B.
Worked example: "Hello, World!" with shift 3
- H (7) + 3 = 10, which is K.
- e (4) + 3 = 7, which is h.
- l (11) + 3 = 14, which is o. The second l gives o again.
- o (14) + 3 = 17, which is r.
- The comma and the space are not letters, so they stay.
- W (22) + 3 = 25, which is Z. Then o becomes r, r (17) becomes u (20), l becomes o, and d (3) becomes g (6).
The result is Khoor, Zruog! To decode it, subtract 3 from each letter, or paste it into the tool in Decrypt mode with the shift set to 3.
The same word at different shifts
| Shift | "Hello" becomes |
|---|---|
| 1 | Ifmmp |
| 3 | Khoor |
| 7 | Olssv |
| 13 | Uryyb |
| 23 | Ebiil |
Shift 23 is the same as shift -3. A shift of 0 or 26 changes nothing, which is why the useful range is 1 to 25.
Decoding without the shift: brute force
If you do not know the shift, try them all. There are only 25 possibilities, so this takes a moment. The brute force table under the tool does it for you. Here is the idea with the message "Phhw ph dw wkh sdun dw 9 sp.":
| Shift tried | Result |
|---|---|
| 1 | Oggv og cv vjg rctm cv 9 ro. |
| 2 | Nffu nf bu uif qbsl bu 9 qn. |
| 3 | Meet me at the park at 9 pm. |
| 4 | Ldds ld zs sgd ozqj zs 9 ol. |
Shift 3 is the only row that reads as English. The tool ranks rows by how closely their letter counts match English, and highlights the best one when the text has at least twelve letters. On very short texts the ranking can guess wrong, so read the rows yourself.
Frequency analysis
There is a second way in, and it works even when you cannot try every key. A Caesar cipher does not change how often each letter appears. In English, E is the most common letter. If the most frequent letter in the ciphertext is H, the shift is probably 3, since E plus 3 is H. This is the same approach used against any simple substitution cipher, and it needs only a few lines of text.
Common mistakes
- Decoding in the wrong direction. If you encrypted with +3, you decrypt with -3. Only ROT13 is its own opposite.
- Forgetting the wrap. Letters near the end of the alphabet roll over to the start. X with shift 5 is C, not a symbol.
- Shifting digits and punctuation. The classic cipher touches letters only. This tool leaves everything else as it is.
- Counting off by one. A shift of 3 means D is 3 places after A. Count the steps, not the letters you land on.
- Trusting a short result. A three-letter word can look like English at several shifts.
Is the Caesar cipher secure?
No. The key space is 25 shifts. Anyone who suspects the cipher can brute force it by hand in a few minutes. Frequency analysis works as well. Because a single shift is applied to every letter, the shape of the language shows straight through.
A stronger relative is the Vigenere cipher, which uses a different Caesar shift for each letter, controlled by a keyword. The Atbash cipher is a fixed cousin with no key at all.
ROT13 and other variants
ROT13 is a Caesar cipher with a shift of 13. Since the alphabet has 26 letters, a second pass brings you back to the start, so one function both encodes and decodes. It is used to hide spoilers and puzzle answers, not secrets. Wikipedia notes it was used on Usenet for exactly this. Shifts of other sizes, such as 1 or 3, do not undo themselves.
A short history
The cipher is named after Julius Caesar. The Roman biographer Suetonius, in his life of Caesar (chapter 56), says Caesar wrote private letters in code by putting D for A and the other letters correspondingly. That is a shift of 3. Suetonius also reports that Augustus used a similar scheme with a shift of one.
Wikipedia credits the earliest surviving description of frequency analysis, the method that breaks the cipher, to the Arab scholar Al-Kindi in the 9th century. It also lists later uses: the Russian army used a Caesar cipher in 1915, and in April 2006 the capture of the mafia boss Bernardo Provenzano was helped by his clumsy Caesar-style messages. A scheme more than two thousand years old still turns up in practice, usually because it is easy to remember.
Related tools
Many puzzles chain several encodings. After the shift, you may still have Morse or binary to read, so keep the Morse code translator and the binary code translator handy.
Sources
- Caesar cipher (Wikipedia): shift of three, brute force, frequency analysis, ROT13, later uses.
- Suetonius, Life of Julius Caesar (LacusCurtius, University of Chicago): chapter 56 on Caesar's private letters.
- ROT13 (Wikipedia): self-inverse shift of 13.
Checked October 2026.
Frequently asked questions
What is a Caesar cipher?
A Caesar cipher replaces each letter with the letter a fixed number of places further along the alphabet, wrapping from Z back to A. With a shift of 3, A becomes D and Hello becomes Khoor. It is one of the oldest and simplest substitution ciphers.
How do I decode a Caesar cipher without knowing the shift?
Try every shift. There are only 25 useful ones, so the brute force table above shows all of them at once and you pick the row that reads as words. Short messages can have more than one plausible row, so read a few before you decide.
What is the Caesar cipher formula?
Number the letters A=0 to Z=25. To encrypt, compute (x + n) mod 26. To decrypt, compute (x - n) mod 26, where n is the shift. For example H (7) with n = 3 gives 10, which is K.
What shift did Julius Caesar use?
Suetonius writes that Caesar put D for A in his private letters, which is a shift of 3. He also reports that Augustus used a shift of one. This is why the shift of 3 is the textbook default.
Is ROT13 a Caesar cipher?
ROT13 is a Caesar cipher with a fixed shift of 13. Because 13 is half of 26, applying it twice returns the original text. Other shifts need the opposite shift to decode.
Is the Caesar cipher secure?
No. There are only 25 possible shifts, so a computer or a patient person can try them all in seconds. Letter frequency also gives it away. Use it for puzzles and teaching. For something stronger in the same family, see the Vigenere cipher.
Does the tool change numbers, spaces and punctuation?
No. Only the letters A to Z, in upper and lower case, are shifted. Digits, spaces, accented letters and symbols pass through unchanged, and uppercase stays uppercase.
How is Caesar different from Atbash?
Atbash reverses the alphabet and has no key. Caesar slides the alphabet by a number you choose. Hello is Svool in Atbash and Khoor in Caesar with shift 3.