HomeCiphers › Frequency analysis

Frequency analysis

Break a cipher by counting. No key, no cleverness, just a tally.

How to do it

Somebody enciphered a message and the bars show how often each of their letters turns up. The message underneath is grey where you have not guessed yet.

Click the tallest bar. In English, E is the commonest letter by a long way, so the tallest bar is probably E. Type E and set it.

Then look at what appears. Short words, doubled letters, and the shapes of words will tell you the next one. THE is the commonest word in English, so a three-letter word ending in your E is worth a guess.

This is how often each letter turns up in ordinary English:

A, E, I, O, N, R, S, T are tall. J, Q, X, Z are almost flat.

Why this beats being clever

A shift cipher has twenty-five keys and falls to trying them all. A simple substitution has four hundred million million million million keys, which no amount of trying will ever get through — and it falls to this, in about ten minutes, with a pencil.

That is the great lesson of code-breaking: the number of keys is almost never the thing that matters. What matters is whether the cipher lets a pattern through. A substitution cipher hides which letter is which, but it does nothing at all to hide how often each one turns up.

Al-Kindi wrote this down in Baghdad in the ninth century, about a thousand years before Europe worked it out. It is the oldest code-breaking method there is and it still ends most classroom ciphers in minutes.

What defeats it

Read more elsewhere

Longer, harder and written for grown-ups. Worth a look when this page runs out.

Cryptanalysis A history of cryptography