Cipher Utility

Vigenère Decoder

C-03

Paste ciphertext and the solver finds the key, no key needed. Runs in your browser; nothing is sent anywhere.

How the key was found

Key

?

Index of coincidence by key length

Bars that reach the line match normal English. The first such length is usually the key length.

Repeated sequences

    Kasiski test: how many repeated letter groups sit a multiple of each length apart.

    Keys tried, best first

      How to break it by hand

      1. Find the key length.
      2. Split the text into that many columns.
      3. Each column is a Caesar cipher.
      4. Match its common letters to E, T, A.
      5. Read the key from the shifts.

      Worked example

      Key length 5

      Most common letter in column 1 is P:

      P is E shifted by 11

      Shift 11 is the letter L:

      Key starts with L

      Further reading

      Cipher Utility reference card Catalog no. C-03

      How the solver works

      A Vigenère cipher shifts each letter by a different amount, taken from a repeating keyword. That hides the usual letter frequencies, but only partly. Every letter that was shifted by the same key letter forms a simple Caesar cipher, so once the key length is known, the problem splits into a handful of easy ones.

      The solver tries every key length up to the maximum you set. For each length it splits the text into columns, finds the shift for each column that best matches English letter frequencies, decrypts, and scores the result by how common its letter pairs are in English. The key with the best score wins.

      Finding the key length

      The index of coincidence is the chance that two letters picked at random from a text are the same. In English it is about 0.065; in random letters it is about 0.038. When the ciphertext is split by the correct key length, each column is plain shifted English and its index jumps to the English level. That jump is what the bar chart shows.

      The Kasiski examination, published by Friedrich Kasiski in 1863, uses repeated groups of letters. When the same word is encrypted by the same part of the key, it produces the same ciphertext, and the distance between the copies is a multiple of the key length.

      The example, step by step

      The sample text was encrypted with the key LEMON. Its index of coincidence is about 0.044 for most lengths but 0.073 at length 5, and length 5 is also at the top of the repeated-sequence list, tied with length 2. Comparing the full letter counts of each of the five columns with English then gives the shifts 11, 4, 12, 14 and 13, which spell L, E, M, O, N. Only the first column can be read off from its most common letter alone; the others need the whole frequency pattern.

      When it does not work

      Short messages are the main problem. With fewer than about 50 letters each column has too few letters for frequency analysis, and several keys can look equally good. Keys that are almost as long as the message, or a running key taken from a book, cannot be found this way either. Neither can ciphers that look similar but work differently, such as the autokey cipher.

      Questions about breaking Vigenère

      Can you really decode a Vigenère cipher without the key?

      Usually, yes, if the message is long enough. The solver first finds the length of the key, then treats every key position as a separate Caesar cipher and finds each letter with frequency analysis. A few hundred letters is plenty. Below about 50 letters there is often too little text to tell the right key from a wrong one.

      How does the solver find the key length?

      It uses two classic tests. The index of coincidence measures how often two random letters match; it jumps to the English level when the text is split by the correct key length. The Kasiski examination looks for repeated letter groups, whose distances tend to be multiples of the key length. Both are shown under the tool.

      What if the decrypted text is still gibberish?

      Try one of the other keys listed under the tool, or raise the maximum key length if the key might be long. The text may also use a different cipher. The autokey cipher looks similar but does not repeat its key, so this method does not work on it.

      What are Beaufort and Variant Beaufort?

      Close relatives of Vigenère that combine the key and the text in a different way. The solver tries all three and reports which one fits. If you know the key already, use the Vigenère cipher tool.

      Is my text sent to a server?

      No. The analysis runs in your browser with JavaScript, and nothing you paste leaves your device.