# Vigenère cipher breaker

This online calculator tries to decode Vigenère cipher without knowing the key. It uses the index of coincidence technique.

If you came here, you probably already know that is Vigenère cipher. If not, you can first check the Vigenère cipher. In short, the Vigenère cipher is a series of Caesar ciphers and is classified as a polyalphabetic substitution cipher. It remained unbreakable for almost three centuries until 1863 when Friedrich Kasiski published a general method of deciphering Vigenère ciphers.

You can use the link above to encode and decode text with Vigenère cipher if you know the key. The calculator below is different. It actually tries to break the Vigenère cipher using text statistics. The technique for breaking the cipher is described below the calculator.

The technique used here to break the cipher is known as **Friedman test** or **kappa test**, invented in the 1920s, and it is based on **Index of Coincidence** or IOC. It is used to find the most likely key length. Then frequency analysis is used to break separate Caesar ciphers, which are simple single substitution ciphers.

The application of the Index of Coincidence for the breaking of Vigenère cipher is described in Wikipedia.

In short, the procedure is the following:

- IOC is used to find out the most likely key length. Text is broken into columns, corresponding to tested key length, and then average IOC for all columns is calculated. The key length with the highest IOC is the probable cipher key length (or product of the multiplication of the key length).
- Determined key length is used to form columns of text - and we know that text in each column is ciphered by a separate Caesar cipher. Now we need to try all possible combinations of Caesar cipher (26 for the English alphabet) and, for each result, compute the frequencies of letters and their correlation to average frequencies of letters in an English text. The Caesar cipher which gives the highest correlation is probably the Caesar cipher used in the Vigenère cipher. Series of such Caesar ciphers give us the Vigenère cipher key.

As you can see with the default calculator input data below, it could work very well. However, it is only an approximation. It can misfire for short text (of course, accuracy increases with the text's size) or if the key is very long or contains repeated patterns. That's why I've included a couple of additional options for this decoder.

Consider the following:

Click to set example dataAs you can see, the found key is **NOOC**. However, the deciphered text has little sense. So, it is time to click the **Show another possible solutions** button. If you do so, you will see the table which lists the possible keys for each tried key length (by default, up to 30). It is easy to spot that the **NONCNNON** key gives much more sense. Note that it has a length of 8 (a multiplication of 4) and a repeating pattern NON--NON. No wonder our most possible solution misfired.

Yet, the deciphered text still has some typos. So, it is time to complete the puzzle and use the **Guess key** option. By looking at the text's typos, you can easily guess that the 5th letter in the **NONCNNON** key is wrong. Guess key allows you to try another variant quickly. Enter **NONCANON** and enjoy the completely deciphered text. The puzzle is solved.

On the final note: I've tried to make this breaker universal. Click the **Edit frequencies** button, and you will have access to the alphabet and frequencies used in the calculator. This allows you to tweak the letter frequencies or to change the alphabet at all. You can tweak frequencies if you suspect the specialized text - it is known that specialized texts (i.e., scientific) have different letter frequencies than regular texts because of different vocabulary. And you can change the alphabet if you suspect non-English text (i.e., Spanish). **If you want to change the alphabet, use uppercased letters and place them in alphabetic order.**

## Comments