Vigenère Decoder: Break the Cipher Without the Key
Paste an encrypted message and this decoder works out the keyword on its own. It measures the index of coincidence to guess how long the key is, runs a Kasiski examination on repeated sequences, then uses letter frequency analysis to read off each key letter. If you already have the keyword, switch modes and decrypt directly. Everything runs in your browser.
Do You Have the Key?
Paste the ciphertext and the solver works out the keyword on its own.
Cipher Variant
Leave this on automatic unless you already know which table produced the message. All three use the same tabula recta and differ only in the direction of the shift.
Longest Key to Try
Every length from 1 up to this value is tested. Raise it only if the result looks like noise, because longer keys need much more ciphertext to pin down.
Ciphertext
Decrypted Text
Statistics
Index of Coincidence by Key Length
English prose sits near 0.066 and random letters near 0.038. The lengths that climb towards English are the ones worth trying.
Kasiski Examination
Sequences that repeat in the ciphertext usually sit a whole number of key lengths apart, so the shared factors of those gaps point at the key length.
How Each Key Letter Was Chosen
Every key position enciphers its own slice of the message with a single Caesar shift. For each slice the solver tries all 26 shifts and keeps the one whose letter distribution is closest to English. A lower chi-squared score means a closer match.
Other Candidates
The next best readings, ranked by how English-like the resulting text is. Select one to load it into the output.
Try an Example
Works well when
- the message runs to a few hundred letters or more
- the plaintext is ordinary English
- the key is short relative to the message
Struggles when
- there are fewer than about 20 letters per key position
- the plaintext is another language, a name list or code words
- the key is as long as the message, which is a one-time pad
What Does It Mean to Decode a Vigenère Cipher?
The Vigenère cipher shifts each letter of a message by an amount taken from a repeating keyword. With the keyword in hand, decoding is simple arithmetic: shift every letter back by the same amount. Without it, you are facing the problem that earned the cipher its old nickname, le chiffre indéchiffrable, the indecipherable cipher.
It turns out not to be indecipherable at all. The repeating keyword is the weakness. Because the same key letter comes round again every few characters, the ciphertext is really several simple Caesar ciphers interleaved, and each one can be attacked on its own with plain letter counting. The only hard part is working out how many there are, which is exactly what the key length analysis on this page does.
What this tool gives you
- The recovered keyword, not just the plaintext
- An honest confidence rating, with the reasoning behind it
- The index of coincidence for every key length it tested
- The repeated sequences and shared factors that Kasiski's method found
- A position by position table showing why each key letter was chosen
- Alternative keys to fall back on when the top answer looks wrong
How to Use the Decoder
Paste the ciphertext
Drop the whole encrypted message into the left box. Spaces, punctuation and line breaks are ignored during the analysis and put back in the result, so there is no need to clean anything up first.
Let it solve, or supply the key
The tool starts in solving mode and needs nothing else from you. If you already know the keyword, switch to Yes, decrypt and type it in.
Read the confidence badge before the plaintext
A high rating means the statistics are firmly behind the answer. Low means the sample is too thin to trust, and the key shown is closer to a guess than a result.
Check the alternatives if it looks wrong
The other candidates are ranked by how English-like their output is. Selecting one loads its plaintext, which is often faster than fiddling with the settings.
How the Solver Breaks the Cipher
The attack runs in three stages, and every stage is shown on the page while it works.
Step 1: Guess the key length with the index of coincidence
The index of coincidence is the probability that two letters picked at random from a text turn out to be the same. Ordinary English lands around 0.066 because a few letters do most of the work, while a uniformly random string of letters sits at 1/26 = 0.0385. Enciphering with a repeating key flattens the distribution and pulls the value down towards random.
Here is the trick. Split the ciphertext into columns by taking every third letter, then every fourth, then every fifth, and so on. When the spacing matches the key length, every column was enciphered by a single Caesar shift, which rearranges the letter frequencies but does not flatten them. The index of coincidence for those columns jumps back towards English. The chart on this page shows that jump, and the peaks are the key lengths worth trying. Note that multiples of the real key length peak as well, which is why a second test is needed.
The measure was introduced by William F. Friedman in 1922, in a monograph titled The Index of Coincidence and Its Applications in Cryptography.
Step 2: Confirm it with a Kasiski examination
Common words repeat in any real message. When a repeated word happens to line up with the same part of the key both times, it produces the same ciphertext both times. That means the gap between two identical ciphertext sequences is usually a multiple of the key length.
So the tool collects every three letter sequence that appears more than once, measures the gaps, factors them, and counts which factors keep coming up. A factor that dominates the tally is a strong hint at the key length. Friedrich Kasiski published this method in 1863 in Die Geheimschriften und die Dechiffrir-Kunst. Charles Babbage appears to have worked out the same idea around 1846 but never published it.
Step 3: Read off each key letter with frequency analysis
Once the key length is fixed, each column is a plain Caesar cipher. The solver tries all 26 shifts for a column and scores each one with the chi-squared statistic, which measures how far the resulting letter counts sit from the frequencies of ordinary English. The lowest score wins, and that shift is the key letter for that position. The per position table on this page lists the winning letter, its score, and the runner up, so you can see how decisive each choice was.
Finally, because chi-squared cannot tell a key length apart from its own multiples, every candidate decryption is scored again as a whole using English bigram statistics, that is, how likely its consecutive letter pairs are in real English. That last pass is what picks the winner among all the lengths and all three cipher variants.
When It Works, and When It Does Not
Every step above is statistical, so the amount of ciphertext matters more than anything else. A useful rule of thumb: the solver needs roughly 20 or more letters for each key position. A six letter key therefore wants at least 120 letters of ciphertext, and comfortably more than that to be reliable.
Good conditions
- A few hundred letters or more of ciphertext
- Ordinary English prose underneath
- A short key, ideally under ten letters
- The full message rather than a fragment
Hard or impossible
- A one line message, which simply lacks the evidence
- Plaintext in another language, or names and code words
- A key longer than the search range, so raise the slider
- A key as long as the message, which is a one-time pad
The last case is worth spelling out. A Vigenère cipher whose key is truly random, as long as the message and never reused, is a one-time pad. Claude Shannon proved in 1949 that such a cipher is unbreakable in principle, not merely hard: every possible plaintext of the right length is equally consistent with the ciphertext, so there is nothing for statistics to grip. What makes ordinary Vigenère breakable is the repetition, not the tabula recta.
A Worked Example
Take the message ATTACK AT DAWN encrypted with the key SKY. The key repeats across the letters of the plaintext:
Plaintext A T T A C K A T D A W N
Key S K Y S K Y S K Y S K Y
Shift +18 +10 +24 +18 +10 +24 +18 +10 +24 +18 +10 +24
Ciphertext S D R S M I S D B S G L Notice what happened to the first three letters. Plaintext A became S in three different places, and the repeated SD at positions 1 and 7 sits exactly six letters apart, a multiple of the key length. That is the Kasiski signal in miniature. On a real message, dozens of such repeats appear and their shared factors give the key length away.
Then the ciphertext splits into three columns by position: S S S S, D M D G and R I B L. Each column is a single Caesar shift, and comparing its letter counts against English frequencies recovers S, K and Y. Twelve letters is far too few for that to actually work, which is precisely why the tool reports low confidence on short inputs instead of pretending.
Vigenère, Beaufort and Variant Beaufort
Three ciphers share the same tabula recta and differ only in which direction the shift runs. A ciphertext that resists one often yields immediately to another, so the decoder tries all three unless you tell it otherwise. Writing P for the plaintext letter, K for the key letter and C for the ciphertext letter, all arithmetic modulo 26:
| Cipher | Encryption | Decryption | Notes |
|---|---|---|---|
| Vigenère | C = P + K | P = C − K | The standard version, and by far the most common |
| Beaufort | C = K − P | P = K − C | Its own inverse, so one operation both encrypts and decrypts |
| Variant Beaufort | C = P − K | P = C + K | Also sold as the "variant Vigenère"; it is Vigenère running backwards |
A quirk worth knowing
Variant Beaufort is not really a separate cipher. Encrypting with variant Beaufort under key K produces exactly the same output as encrypting with plain Vigenère under the complement of K, where A stays A, B becomes Z, C becomes Y and so on. So a message enciphered with variant Beaufort and the key SKY is identical to the same message enciphered with Vigenère and the key IQC. When the solver meets this situation it reports both readings rather than listing the same answer twice.
Decrypting When You Already Have the Key
Switch to Yes, decrypt and type the keyword. Only letters count, so spaces, digits and punctuation in the key are dropped, and case does not matter. Watch the index of coincidence tile as you type: a value near 0.066 means the decrypted text behaves like English and the key is almost certainly right, while a value near 0.038 means it is not.
To go the other way and encrypt a message, use the Vigenère cipher encoder, which also draws the tabula recta and shows how the keyword lines up against your text.
If the Result Looks Wrong
The plaintext is gibberish and confidence is low
Almost always a length problem. Find more of the same message, encrypted with the same key, and paste it all in together. Two hundred extra letters can turn an unusable result into an obvious one.
The key looks close but a couple of letters are off
That is the classic near miss: the length is right but one or two columns were thin. Read the plaintext, work out what the wrong letters should have been, then switch to manual mode and correct the key by hand.
The key came out as a repeated pattern
It should not, because the tool collapses a key like KEYKEY down to KEY before reporting it. If you see a repetition anyway, the underlying key genuinely contains one.
Nothing works and the text is not English
The letter and bigram statistics behind the solver are English. Other languages have their own distributions, and feeding them English expectations produces confident nonsense. Try the text analysis tool to inspect the frequencies yourself.
It might not be a Vigenère at all
If the ciphertext already has an index of coincidence near 0.066 at key length 1, it is a monoalphabetic cipher, so try the Caesar cipher or Atbash tools. If the key never repeats in a fixed cycle, you may be looking at an autokey cipher, which this solver does not attack.
Related Tools
Vigenère Cipher Encoder
Encrypt with a keyword and watch the tabula recta line up against your text.
Try our Vigenère Cipher tool →Autokey Cipher
Vigenère's own improvement, where the plaintext extends the key so it never repeats.
Try our Autokey Cipher tool →Caesar Cipher
The single shift cipher that each column of a Vigenère message reduces to.
Try our Caesar Cipher tool →Text Analysis
Count letters, words and character frequencies in any text you are trying to identify.
Try our Text Analysis tool →Frequently Asked Questions
How do you decode a Vigenère cipher without the key?
You attack the repetition rather than the cipher. First work out how long the key is, using the index of coincidence and the gaps between repeated sequences. Then split the message into that many columns, each of which is a simple Caesar cipher, and solve each one by comparing its letter frequencies against English. That is exactly what this page does when you paste a ciphertext in.
Is the Vigenère cipher unbreakable?
No. It held that reputation for roughly three centuries and was called le chiffre indéchiffrable, but Charles Babbage broke it around 1846 and Friedrich Kasiski published a general method in 1863. Only one special case is truly unbreakable: a key that is random, as long as the message and never reused, which is a one-time pad. Shannon proved that case secure in 1949.
How much ciphertext does the solver need?
Plan on about 20 letters per key position, so roughly 100 letters for a five letter key and 200 for a ten letter key. Below that the frequency counts are too noisy to separate the right shift from a plausible wrong one. The tool refuses inputs under 20 letters outright and marks thin samples as low confidence rather than guessing quietly.
What is a variant Vigenère cipher?
It is another name for the variant Beaufort, which subtracts the key during encryption instead of adding it. Mathematically it is the ordinary Vigenère cipher with the key letters complemented, so the same ciphertext can be described either way. Select it explicitly in the variant dropdown if you want the key expressed in that form.
Can it decode text that is not in English?
Not reliably. The frequency and bigram statistics behind the scoring were counted from English prose, and other languages have noticeably different distributions. The decryption arithmetic is language neutral, so if you know the key the manual mode works on any language. Only the automatic solving is English specific.
Why does the tool show several possible keys?
Because statistics rank answers, they do not prove them. The top candidate is the one whose plaintext reads most like English, but when the ciphertext is short the gap between first and second place can be small. Seeing the runners up lets you judge for yourself instead of taking a single answer on faith.
Does my ciphertext get sent anywhere?
No. The whole solver, including the English language statistics it scores against, runs as JavaScript in your browser. Nothing is uploaded, stored or logged, and the page keeps working if you go offline after loading it.
Technical Implementation
The key length search compares the average index of coincidence of the columns produced at every candidate period. For a text of N letters with counts ni per letter, the index is:
IC = Σ nᵢ (nᵢ − 1) / (N (N − 1))
English prose ≈ 0.066
Random letters ≈ 0.038 (1 / 26) Each column is then scored against English letter frequencies with chi-squared. Rather than deciphering the column 26 times, the solver counts its letters once and reads each trial key letter off as a permutation of those counts:
for (let keyIndex = 0; keyIndex < 26; keyIndex++) {
let chiSquared = 0;
for (let cipherIndex = 0; cipherIndex < 26; cipherIndex++) {
const plainIndex = decryptIndex(cipherIndex, keyIndex, variant);
const expected = ENGLISH_LETTER_FREQ[plainIndex] * column.length;
const difference = counts[cipherIndex] - expected;
chiSquared += (difference * difference) / expected;
}
scores.push({ letter: ALPHABET[keyIndex], chiSquared });
} Every resulting candidate is finally ranked by its average bigram log probability, which is what separates the true key length from its multiples and picks between the three cipher variants. The English letter and bigram tables were counted from roughly 2.7 million letters of public domain prose from Project Gutenberg, and ship with the page as a small data file rather than being fetched at runtime.
Why this is worth understanding
The Vigenère cipher is the clearest example in cryptography of a system that looks secure and is not. Nothing about the tabula recta is flawed. The break comes entirely from reusing key material, and that same mistake has sunk far more modern systems, from repeated stream cipher keystreams to reused initialisation vectors.
A note on responsible use
This decoder exists for puzzles, coursework, capture the flag challenges and the history of cryptography. The cipher offers no meaningful protection today, so nothing of real value should be secured with it. For that, use modern authenticated encryption.