The Black Chamber RU

Tools · Analysis and cracking

Frequency analysis

Letter and bigram frequencies and the index of coincidence, against English or Russian.

Runs in your browser. Your text goes nowhere.

How to use it

Paste a text or a ciphertext. Everything is recalculated as you type. At the top is the verdict: what the text looks like. Below are the frequency bars. In “Alphabetical” mode each letter stands in its place, and the red mark shows how often it occurs in ordinary language. In “By frequency” mode the text's letters are lined up from commonest to rarest, and the grey bars and the bottom row are the language's letters in the same order. That is al-Kindi's first guess: the commonest sign of the ciphertext most likely stands for the commonest letter of the language.

The alphabet is detected from the text: Latin (26 letters) or Russian (33, with ё counted separately). You can also pick it by hand.

What the numbers mean

The index of coincidence is the chance that two letters picked at random from the text are the same. English scores about 0.067, Russian about 0.055, and an even jumble of letters 1/26 ≈ 0.038 (1/33 ≈ 0.030 for Russian). A substitution cipher doesn't change it, since it only relabels letters. Vigenère and other polyalphabetic ciphers lower it.

Unevenness is the same index on a scale from random letters (0%) to the language (100%).

χ² (chi-squared) compares how often each letter occurs with how often that same letter occurs in the language. When the letters are in their own places, χ² is small, roughly the number of letters or less. When the frequencies are there but on the wrong letters, χ² is huge.

How the verdict works

Two numbers together tell three cases apart. High unevenness and a small χ²: ordinary text (or a transposition, which leaves frequencies alone). High unevenness and a large χ²: one alphabet swapped for another. The tool then tries every Caesar shift and every affine key, Atbash included, and if one of them gives readable text it names it. Otherwise it is a substitution with an arbitrary key. Low unevenness: several alphabets, as in Vigenère, or just random letters.

Statistics need material: below forty letters the tool won't judge, and the verdicts become reliable from two or three hundred.

Bigrams

Pairs of neighbouring letters inside words. Common English pairs are TH, HE, IN, ER; common Russian ones are СТ, НО, ТО, НА. A substitution hides them, but the cipher's own common pairs show where they went: if the commonest sign is E, then a pair “?E” at the top of the list is most likely HE.

FAQ

What is the most common letter in English?

E, about 12.7% of all letters, followed by T, A, O, I and N. In Russian it is О, about 11%.

How do I use this to break a cipher?

The substitution lesson walks through it step by step. If the verdict says several alphabets, head to the Vigenère tool.

Is it safe to paste my text here?

Yes. Everything runs in your browser and nothing is sent to a server.