Cipher Table

Caesar cipher

Slide every letter a fixed number of places along the alphabet. Type on either side, turn the wheel, or press the red button to break a message when you don't know the shift.

Key

How the Caesar cipher works

Pick a number between 1 and 25. That is your key. To encipher a message, replace each letter with the one that many places further along the alphabet, wrapping round from Z back to A. 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 read the message, the receiver shifts every letter back by the same amount. Spaces and punctuation are usually left alone, which, as we’ll see, is a gift to anyone trying to break it.

In arithmetic terms, number the letters A = 0 to Z = 25. Enciphering is add the key and take the remainder after dividing by 26; deciphering is the same with subtraction.

How to break it

The Caesar cipher has two fatal weaknesses.

There are only 25 keys. You can simply try each one. This is called a brute-force attack, and here it takes a person a few minutes and a computer no time at all.

It keeps the shape of the language. Every E becomes the same letter, so the most common letter in the ciphertext is very probably E (or T, or A). Find it, count how far it is from E, and you have the shift. Short words help too: a lone letter is almost always A or I.

The breaker on this page does the first and checks with a more careful version of the second: it scores each of the 25 candidates on how well its four-letter sequences match real English, then ranks them.

A short history

Suetonius, writing about a century and a half after Julius Caesar’s death, records that Caesar wrote confidential letters by replacing each letter with the one three places on. It was good enough at the time: many of his enemies could not read at all, and those who could might have taken it for a foreign language.

The first recorded method for breaking ciphers like this came some nine hundred years later, from the Arab scholar al-Kindi, who described counting letter frequencies in the ninth century. The Caesar shift lived on anyway. It reappears as the building block of the Vigenère cipher, which is simply several Caesar shifts taking turns.

Questions people ask

How do I decode a Caesar cipher without the key?

There are only 25 possible shifts, so try them all and pick the one that reads as English. The "Break without the key" button does exactly that, scoring every attempt by how English it looks, and shows you the full list so you can check its work.

What shift did Julius Caesar use?

According to the Roman historian Suetonius, Caesar shifted by three, so A became D. His nephew Augustus is said to have used a shift of one.

Is the Caesar cipher secure?

No. It can be broken by hand in a couple of minutes, and instantly by a computer. It is useful for puzzles, games and teaching, not for keeping real secrets.

What is the difference between a Caesar cipher and ROT13?

ROT13 is a Caesar cipher with the shift fixed at 13. Because 13 is half of 26, applying it twice returns the original text.