In this article
Julius Caesar is said to have used a simple trick to hide military messages: shift every letter a few places along the alphabet. The method is easy to learn and a good first step into cryptography. It is also easy to break, and seeing why teaches the key idea behind every secure system.
How it works
Write the alphabet twice, one row shifted. To encrypt, find each letter in the top row and replace it with the letter below it. To decrypt, go back the same number of places. The shift amount is the key.
| Plain | H | E | L | L | O |
|---|---|---|---|---|---|
| Shift 3 | K | H | O | O | R |
| Shift 13 (ROT13) | U | R | Y | Y | B |
Shift 13 is special: applying it twice returns the original, because 13 + 13 = 26 letters.
Why it is so weak
A shift of 0 does nothing and a shift of 26 returns to the start, so only shifts 1 to 25 change the text. An attacker does not need to guess the key. They try all 25 and read the one that makes sense.
- Shifts to try25
- 1Take the ciphertextFor example KHOOR.
- 2Try shift 1 to 25Decode with each one. It takes seconds by hand and microseconds by computer.
- 3Read the resultsOnly one will be a real word. Shift 3 gives HELLO.
A bigger key space still is not enough
What if each letter could be swapped for any other, not just by a fixed shift? That is a general substitution cipher, with 26! (26 factorial) possible keys, about 4.03 × 10²⁶. Brute force is hopeless. But the cipher still leaks, because the language does.
These are approximate averages for English. In a long ciphertext, the most common symbol is likely E, the next T, and so on. That is enough to start cracking the cipher.
Count the letters in the ciphertext and match the most common to E, T and A. Then use common words like THE and AND to refine. A few paragraphs of text usually give it away. This is frequency analysis, known for over a thousand years.
What modern encryption does differently
- Same shift for every letter
- Pattern of the language shows through
- Cracked by hand in minutes
- Scrambles bits, not letters
- Output looks random
- Brute force is infeasible
AES-256 has about 1.2 × 10⁷⁷ keys. And the security does not rest on keeping the method secret, only the key.
Where the Caesar cipher is still used
- Puzzles and escape rooms. Easy to make and to solve.
- ROT13 on forums. Used to hide spoilers so you must choose to read them. It is not security.
- Teaching. It shows keys, encryption and brute force in one small example.
- Obfuscation. It sometimes hides text from a casual look. Do not use it for passwords. See password entropy for what real strength looks like.
A quick challenge
Decode WKLV LV IXQ with a shift of 3. Go back three letters for each: W→T, K→H, L→I, V→S. The message is THIS IS FUN. Try the tool above with your own message and share the shift with a friend.
Questions people ask
How does the Caesar cipher work?
Each letter is replaced by the letter a fixed number of places further along the alphabet, wrapping around after Z.
How many keys does a Caesar cipher have?
25 useful shifts (1 to 25). Shift 0 and 26 leave the text unchanged.
How do you break a Caesar cipher?
Try all 25 shifts and read the one that gives real words, or use letter frequency to guess the shift.
What is ROT13?
A Caesar cipher with a shift of 13. Applying it twice returns the original text.
Is the Caesar cipher secure?
No. It is easy to crack and should only be used for fun or learning.

