← Codes you can try

Crack a code by counting letters

Paste a Caesar-coded message, count its letters, and let the counts point to the shift.

Some letters turn up far more than others in English. A Caesar cipher moves them all the same distance, so the pattern survives. Using that pattern to crack a code is called frequency analysis. See it, then use it.

Don’t type real passwords or private information.

The letter-count tool

Don’t type real passwords or private information. It counts the letters A to Z, in either case; accented and other letters are ignored. It works best on a few sentences or more.

2. See the letter counts

Paste a coded message to see its letter counts (the letters A to Z). The outlined bars show typical English.

Show the letter counts as a table
Letter counts for your message, and typical English
LetterCountYour messageTypical English

I Why it works

Why counting letters works

In English the letters are not used equally. E is the most common, then T and A. A Caesar cipher moves every letter the same number of places, so every E becomes the same new letter, and that new letter turns up just as often as E did. The counts keep their shape. The labels are all that has moved.

A8.04%BCDE12.49%FGHIJKLMNOPQRST9.28%UVWXYZ
The alphabet, with the three most common English letters standing out: E, T and A.

So if the most common letter in a coded English message is W, then W probably stands for E, and the shift is 18. The tool checks every shift this way, not just one.

II The guess

How the guess is made

The tool tries all 25 shifts. For each one it moves every letter of your message back by that many places, counts the letters of the result, and adds up, letter by letter, how far those counts are from what typical English would give. The shift with the smallest total is the best guess, and the next two smallest are shown as well.

The typical English figures come from Peter Norvig’s count of 3,563,505,777,820 letters in the Google Books data. His table puts E at 12.49%, T at 9.28% and A at 8.04%. Simon Singh’s Black Chamber gives 12.7% for E from another count; different texts give slightly different numbers, and that is one reason the answer is a guess.

III History

A little history

Nobody knows who noticed it earliest, but the earliest known description of codebreaking by counting letters is by al-Kindi, a scholar of the 9th century known as the “philosopher of the Arabs”. His book, A Manuscript on Deciphering Cryptographic Messages, was lost to view and was found again in 1987 in an Ottoman archive in Istanbul.

Singh calls the cracking of the substitution cipher the birth of cryptanalysis, the art of reading codes without the key.

IV Longer messages

Why it needs a longer message

The figures are averages. A short message may not follow them: in a few words, the most common letter might not be E at all. The longer the message, the closer its counts get to the average. In 1969 the French writer Georges Perec published a novel of about 300 pages without once using the letter E. A message like that has no peak where E should be, so the tool goes by the other letters instead.

Code a single sentence on the Caesar page, paste it here, then do the same with a whole paragraph, and watch how the best guess and the other two compare. Ordinary English that was never coded has no shift to find, and the tool says so.

V Vigenère

Why it is weaker on Vigenère

A Vigenère cipher codes each letter in several ways, depending on the keyword. With an 8-letter keyword, every letter of the message can be coded as any of up to 8 different letters (fewer if the keyword repeats a letter), so the peak that E would make is shared out among them. Counting the letters of the whole message then gives a much flatter picture that points to no single shift, and the guesses here come out as nonsense.

The counts can still help once the length of the keyword is known: the letters that met the same keyword letter were all moved by the same shift, so each of those groups is a Caesar cipher on its own. The Vigenère page shows how repeats can give the length away.

VI Keep going

Keep going

Go back to the Caesar cipher to code a message of your own, or try the Vigenère cipher, which was meant to defeat exactly this.

VII Sources

Sources

Simon Singh’s Black Chamber: Cracking the Substitution Cipher (opens in a new tab), Letter Frequencies (opens in a new tab) and Why is Vigenère so strong? (opens in a new tab).

The English letter figures: Peter Norvig, “English Letter Frequency Counts: Mayzner Revisited” (opens in a new tab). Checked 19 November 2026.