How to use the Caesar cipher tool
- Pick Encode to hide a message or Decode to reveal one.
- Set the shift with the slider. Shift 3 is the classic Caesar key; ROT13 is a shift of 13.
- Type your message. The result updates as you type and can be copied with one click.
- Don't know the key? Press Try all 25 to see every possible shift at once.
How the Caesar cipher works
Write the alphabet, then write it again moved along by the key. Each letter of the message is swapped for the letter below 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 |
So HELLO becomes KHOOR. To decode, read the table from bottom to top, or shift by the same number in the opposite direction. Mathematically, each letter position x becomes (x + key) mod 26.
Cracking a Caesar cipher
Because there are only 25 useful keys, the fastest attack is brute force: decode the message with every shift and look for the one that makes sense. That is what the Try all 25 button does. For long messages there is another clue: E, T and A are the most common letters in English, so the most common letter in the ciphertext usually stands for E.
History
The cipher is named after Julius Caesar, who, according to Suetonius, used a shift of three in his private letters. Simple substitution ciphers like this were enough at a time when few people could read. Today the Caesar cipher is a first step in learning cryptography and a favourite in escape rooms, geocaching and puzzle hunts.