Caesar Cipher Encoder and Decoder

Shift every letter of your message by a fixed number of places to encode it, shift back to decode it, or let the tool try all 25 shifts when you don't know the key.

Phhw ph dw wkh rog rdn wuhh dw qrrq

How to use the Caesar cipher tool

  1. Pick Encode to hide a message or Decode to reveal one.
  2. Set the shift with the slider. Shift 3 is the classic Caesar key; ROT13 is a shift of 13.
  3. Type your message. The result updates as you type and can be copied with one click.
  4. 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:

PlainABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherDEFGHIJKLMNOPQRSTUVWXYZABC

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.

Frequently asked questions

How do I decode a Caesar cipher?

Choose 'Decode', set the shift to the key that was used to encode the message, and paste the ciphertext. If you don't know the shift, press 'Try all 25'; the row that reads as normal English is the answer, and the tool stars the most likely one.

What shift did Julius Caesar use?

According to the Roman historian Suetonius, Caesar shifted letters by three, so A became D and B became E.

What is ROT13?

ROT13 is a Caesar cipher with a shift of 13. Because the alphabet has 26 letters, applying ROT13 twice returns the original text, so the same operation both encodes and decodes.

Is the Caesar cipher secure?

No. There are only 25 possible shifts, so anyone can try them all in seconds, and letter frequencies give the key away in longer texts. Use it for puzzles, games and teaching, never to protect real secrets.

What happens to numbers and punctuation?

They stay the same. Only the letters A to Z are shifted, and uppercase and lowercase are kept as they were.

More free tools