Cracking a Vigenere Cipher


The Vigenere cipher can be broken in two steps: first find the length of the key, and then use frequency analysis to guess each letter of the key.

Choose an excerpt or copy and paste your own ciphertext into the box on the right.

The key length can be found using Kasiski examination. Choose a string length to search for (four is often a good choice), and click "Search." You will see a list of strings that show up more than once in the ciphertext. These are likely to correspond to identical strings from the plaintext that happen to have been encoded with the same portion of the key. So the distance between them is likely to be a multiple of the key length. Look for a common factor among the distances, and try that for a key length.

Next, enter your chosen key length in the other box and click "Calculate frequencies." You should see a histogram for each letter of your key. Clicking on a histogram will highlight all letters in the message that are encrypted with that letter. Use the arrow keys to rotate through the possible key letters until the frequency histogram matches the expected one for English as closely as possible. Once you have done that for each letter, your cipher should be solved.

String length to search for:

Key length: