How to use the Caesar cipher decoder
- To encode, type your message and choose a Shift from 1 to 25. The hint next to the box shows what A becomes.
- To decode, press the arrows between the two labels and paste the coded message. If you know the shift, set it.
- If you do not know the shift, look at All 25 shifts under the box. The row marked Most likely is the one whose letters best match English. Tap any row to use that shift.
- Press Copy to paste the result anywhere.
How the Caesar cipher works
Write the alphabet, then write it again moved along by the shift. Each letter of the message is swapped for the letter under it. With a shift 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
- Coded: 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
So HELLO becomes KHOOR. To decode, move each letter back by the same shift. A shift of 23 forward is the same as 3 back, which is why there are only 25 useful shifts.
How the decoder finds the shift
English uses some letters far more than others: E, T, A, O and I are common, while J, Q, X and Z are rare. A Caesar cipher moves those frequencies along with the letters, so in a coded message the most common letter is often the one E turned into. The decoder undoes each of the 25 shifts, counts the letters in each result and compares them with normal English letter frequencies using a chi-squared score. The result that fits best is marked Most likely.
This works well on a sentence or more. On a few words the counts are too small to be reliable, so check the other rows if the top one looks wrong.
History of the Caesar cipher
The Roman historian Suetonius wrote that Julius Caesar wrote private letters by replacing each letter with the one three places further on, so that A became D. His successor Augustus is said to have used a shift of one. The cipher was easy to break once people knew the method, and in the 9th century the Arab scholar al-Kindi described frequency analysis, the counting technique that breaks it.
Today the Caesar cipher is a first lesson in cryptography and a favorite in puzzle hunts, escape rooms and games. ROT13, its shift of 13, is still used online to hide spoilers and puzzle answers.
Related ciphers
- The Atbash cipher reverses the alphabet instead of shifting it.
- The Vigenère cipher uses a different Caesar shift for each letter, set by a keyword.
- The letter to number converter swaps letters for their numbers, the A1Z26 cipher.