Cipher guide
Caesar Cipher: How It Works and How to Crack It
The Caesar cipher moves every letter a fixed number of places along the alphabet. It is the first cipher most people meet, and one of the easiest to break.
How the Caesar cipher works
Pick a number from 1 to 25. That is the shift. To encode a message, replace each letter with the one that many places later in the alphabet, wrapping from Z back to A. To decode, move the same number of places back.
With a shift of 3, A becomes D, B becomes E and Z becomes C:
Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC
So HELLO becomes KHOOR. Spaces and punctuation are usually left alone, which gives away word lengths.
How to crack it by hand
- Try every shift. There are only 25. Write the first few letters shifted by each amount and look for one that reads as a word.
- Or use a short word. Single letters are probably A or I. Three-letter words are often THE or AND. If one fits, the difference between the letters is the shift.
- Or count letters. In English text, E is the most common letter. The most common letter in the ciphertext is probably E shifted. Count how far it sits from E.
- Check the whole message. Apply the shift to everything and make sure it reads cleanly.
Worked example
Ciphertext:
ZKDW LV WKH DQVZHU
The middle word, WKH, has three letters and a pattern that looks like THE. If W stands for T, then the shift is 3 (T plus 3 is W). Moving every letter back 3 places gives:
WHAT IS THE ANSWER
Z goes back to W, K to H, D to A and W to T, so the first word is WHAT, and the guess is confirmed.
Why it is easy to break
A Caesar cipher has 25 possible keys, so a person can try all of them in minutes, and a computer in no time. It also keeps the pattern of English letter frequencies, only shifted. Stronger ciphers such as Vigenère use several shifts to hide that pattern.
Decode your own text
The solver lists all 25 shifts and marks the one that looks most like English.
Open the cipher solverQuestions
Common questions
- How many keys does a Caesar cipher have?
- Twenty-five useful ones. A shift of 26 returns the original letters, so trying shifts 1 to 25 covers every possibility.
- Is ROT13 the same as a Caesar cipher?
- ROT13 is a Caesar cipher with a shift of 13. Because the alphabet has 26 letters, encoding and decoding are the same step.
- What if the message has no spaces?
- Cracking still works. Try every shift and read each result, or count letters and assume the most common one stands for E.
- Why does my result still look like nonsense?
- The message may use another cipher. If no shift reads as English, try Atbash, or check the letter frequencies for a substitution cipher or a Vigenère cipher.