Home › Ciphers › Vigenère Cipher
Vigenère Cipher
For three centuries this was le chiffrage indéchiffrable — the indecipherable cipher. Instead of one alphabet for the whole message, a keyword repeats over the text and every letter is Caesar-shifted by the key letter above it, so the same plaintext letter wears a different disguise each time it appears. This page encodes and decodes with any keyword, shows the keystream doing its work, and then explains the repetition that eventually betrayed the cipher — and how to measure it.
The Vigenère cipher is a polyalphabetic substitution cipher: a keyword, repeated over the message, selects a different Caesar shift for every letter. With key LEMON, ATTACK AT DAWN becomes LXFOPV EF RNHR. It resisted general solution for about 300 years, then fell to Kasiski's repetition attack (published 1863) plus ordinary frequency analysis, column by column.
Named for Blaise de Vigenère, though Giovan Battista Bellaso published the repeating-key system first, in 1553. Have a Vigenère message but no key? The Vigenère cipher solver finds the key length and the key.
Encode or decode, with any keyword
The hint button treats your text as a ciphertext of unknown key length and scores each candidate length by the index of coincidence — the first step of the real attack. Everything runs in your browser.
A keyword turns one Caesar into many
Write the keyword repeatedly above the message — LEMONLEMONLE… — and shift each plaintext letter forward by the alphabet position of the key letter above it (A=0 … Z=25). In arithmetic: C = (P + K) mod 26 per letter; decoding subtracts, P = (C − K) mod 26. Equivalently, use the tableau in the reference section: find the row by key letter, the column by plaintext letter, and read the intersection. The tool computes the arithmetic form; the keystream line under the result shows the key exactly as it was applied, so you can check any letter by hand against the table.
Three details run the whole cipher. First, the key advances only on letters — spaces and punctuation consume no key letter, which is why ATTACK AT DAWN encrypts to LXFOPV EF RNHR with the pattern intact across the gaps. Second, the same letter encrypts differently under different key letters: the three T's of ATTACK become X, F and V under E, M and L. That variety is what flattens the letter frequencies that kill Caesar and substitution. Third, the keystream restarts: after N comes L again. That restart is a rhythm, and a rhythm can be measured — the entire attack in the Breaking section is built on it.
Choosing a key that deserves the cipher
The cipher's strength is conditional, and the condition is the key. A short, meaningful keyword — a name, a word from the message's subject — repeats often and can be guessed or dictionary-attacked. Length is what buys security: each added key letter multiplies the work of the column attack and dilutes the repetitions Kasiski hunts. The limiting case makes the point: if the key is as long as the message, never repeats and is truly random, the system becomes the one-time pad — the one cipher that is provably unbreakable when used correctly. Vigenère with a five-letter keyword is that idea at pocket scale, with pocket-scale strength to match.
Bellaso's cipher, Vigenère's name, Kasiski's break
The repeating-key polyalphabetic cipher was published by the Italian cryptologist Giovan Battista Bellaso in 1553, building on Johannes Trithemius's earlier idea of stepping through shifted alphabets in fixed order (1508) and Leon Battista Alberti's polyalphabetic discs (1467). Blaise de Vigenère described a stronger autokey variant in his 1586 treatise — the key primed by a single letter, then continued by the plaintext itself — but it is his name, not Bellaso's, that history attached to the whole family. The misattribution is worth stating plainly, because this page's cipher is Bellaso's system: a keyword, repeated.
For roughly three centuries the system had no published general solution and earned its French nickname, le chiffrage indéchiffrable. Charles Babbage broke it privately around 1854 — his work, prompted by a newspaper challenge, went unpublished — and the Prussian officer Friedrich Kasiski published the first general method in 1863: find repeated ciphertext fragments, measure the distances between them, and take the distances' common divisors as candidate key lengths. Once the length is known, the cipher collapses into a handful of interleaved Caesars. William Friedman's index of coincidence (1920s) later gave analysts a statistical way to find the same length without waiting for repetitions. The hint button above automates Friedman's version.
- 1467 — Alberti's polyalphabetic disc: the founding idea.
- 1553 — Bellaso publishes the repeating-keyword cipher.
- 1586 — Vigenère's treatise describes the autokey variant; his name sticks to the family.
- c. 1854 — Babbage breaks the cipher; the work stays unpublished.
- 1863 — Kasiski publishes the general attack.
- 1920s — Friedman's index of coincidence makes key length a measurement.
The Vigenère tableau
The full 26×26 square — every Caesar row, labelled by its key letter — is generated below by the same arithmetic the tool runs. To encode by hand: find the key letter's row, the plaintext letter's column, and read the cell. The standalone Vigenère table page carries the printable version.
Row L is the Caesar alphabet shifted by 11, row E by 4, and so on — the tableau is twenty-six copies of the Caesar cipher stacked, which is precisely what the key selects between, letter by letter.
The textbook example, and one more
Example 1 — ATTACK AT DAWN under LEMON
Letter by letter, with every number shown: A(0)+L(11)=L, T(19)+E(4)=23=X, T(19)+M(12)=31−26=5=F, A+O=O, C(2)+N(13)=15=P, K(10)+L(11)=21=V. This is the most reproduced worked example in the cipher's literature, and the tool above reproduces it exactly — it is a test, not a hope. Watch the three plaintext T's become X, F and V: the same letter wearing three disguises, which no Caesar or substitution can do. And note the keystream restarting at L after N — LEMON LEMON LE… — the repetition Kasiski hunts for.
Example 2 — a longer message under FALCON
Thirty-one letters under a six-letter key. The plaintext's most common letter, E, appears under five different key letters and comes out as T, Q, S, R and G — a frequency counter sees no dominant letter to grab. Decode it above with the same key to watch the arithmetic reverse, then press the hint button on the ciphertext: with only 31 letters the statistics are thin, which is itself the honest lesson about short Vigenère texts.
Example 3 — Kasiski in miniature
Encrypt a run of one repeated letter and the ciphertext is the key, printed by the message. Real text is not that cooperative, but the mechanism is identical: whenever a common plaintext fragment — THE, AND, or the double letters inside a word — recurs at a distance that is a multiple of the key length, it meets the same key letters and produces the same ciphertext fragment. The attack is then bookkeeping: measure the distances, take their common divisors.
Find the length, and the cipher becomes Caesars
Every practical attack follows the same two steps. Step one: find the key length. Kasiski's method looks for repeated fragments and factors the distances between them. Friedman's index of coincidence measures it directly: split the ciphertext into n columns for each candidate length, and average the columns' IoC — a statistic that sits near 0.067 for English-like text and near 0.038–0.042 for flattened, random-looking text. At the true length (and its multiples), each column is a single Caesar alphabet, so the columns read English-shaped and the IoC jumps. On this site's standard test sentence encrypted under LEMON and doubled for length, the hint engine reports 0.065 at length 5 and 0.063 at its multiple 10, against roughly 0.04 everywhere else — the shortest strong peak is the answer, and the solver automates the whole procedure.
Step two: solve each column as a Caesar. With the length known, every key letter governs its own interleaved stream, and each stream falls to the chi-squared frequency fit used by the Caesar solver. The honest limits are length and key quality: a short ciphertext (under roughly 20 letters per key letter) starves both steps of statistics; a long or random key starves them entirely; and a keyword drawn from a dictionary can be attacked by simply trying the dictionary — which is why the solver also runs a key-dictionary pass. What no attack recovers is the limiting case: key as long as the message, random and never reused is the one-time pad, and it does not fall at all.
- Security status: broken for short keywords since 1863; safe only as it approaches one-time-pad conditions.
- What gives it away: repeated fragments at key-length multiples; column IoC peaks at the true length.
- If frequencies are English-shaped with no column structure: it may be a single substitution instead — the Identifier measures both.
Beaufort, autokey, running key
| Relative | How it differs | Where it lives |
|---|---|---|
| Beaufort | Reverses the arithmetic — C = (K − P) mod 26 — so the key letter is the starting point; a variant Beaufort subtracts the other way and is its own inverse | The Beaufort page; the distinction is compared in Vigenère vs Beaufort |
| Autokey | Vigenère's own 1586 system: the key is primed with one letter, then continued by the plaintext itself, so it never repeats on a period | The autokey page |
| Running key | The “keyword” is a long text — a book passage — so the keystream is language, not a repeating word; Kasiski finds no period, but the key text's own statistics leak | The running-key page |
| Gronsfeld | Vigenère restricted to a numeric key: digits 0–9 select from only the first ten Caesar rows | The Gronsfeld page |
| Porta | Uses 13 reciprocal alphabets keyed by letter pairs — encoding and decoding are the same operation | The Porta page |
The family resemblance to keep straight: Caesar is Vigenère with a key one letter long and constant; the substitution cipher is the fixed-alphabet case Vigenère was invented to escape. Vigenère sits exactly between them — many alphabets, but cycling.
Three centuries of trust, and a second life in puzzles
Vigenère was a working diplomatic and military cipher for centuries — used, among others, by Confederate forces in the American Civil War, whose short, guessable keys (MANCHESTER BLUFF, COMPLETE VICTORY) let Union analysts read their traffic: a historical demonstration that the cipher is only as strong as its key discipline. Its reputation outlived its security by decades; well into the computer age, “Vigenère” was still being proposed in earnest for light commercial secrecy. Today it is the serious tier of puzzle cryptography — the point in a CTF or puzzle hunt where Caesar tricks stop working and real cryptanalysis (key length, columns, scoring) begins — and the standard classroom example of a cipher that is strong against the attacks of one era and transparent to the next. The solver on this site exists because Vigenère is where solving stops being a lookup and becomes a method.
One to decode, one length to find
Practice 1 — decode with the key given
Reveal the answer
“THE EAGLE HAS LANDED AT THE NORTH GATE” — Worked Example 2 read backwards. Check any letter against the tableau: the first key letter F is row 5, and T(19)+5=24=Y.
Practice 2 — find the key length by eye
Reveal the answer
One fragment repeats: XTS appears at letter positions 12 and 27 of the message (counting letters only), a distance of 15 apart. A repeat can only happen when the same plaintext meets the same key phase, so the key length divides 15: it is 3, 5 or 15. The key is LEMON — length 5 — and the repeated fragment is THE, encrypted identically both times because the two THE's sit exactly three key-periods apart. In a longer message you would collect several such distances and take their common divisors; here the plaintext was “THE BRIDGE AT THE RIVER BEND AND THE BRIDGE AT THE OLD MILL”, which you can confirm in the tool above. That counting-and-factoring is Kasiski's whole method.
For paper work, the printable tableau on the Vigenère table page is the companion sheet for this cipher.
Frequently asked questions
Did Vigenère invent this cipher?
No — and this page says so in its history section rather than repeating the usual shorthand. Bellaso published the repeating-keyword system in 1553; Vigenère's 1586 contribution was the autokey variant. The family kept Vigenère's name anyway, three centuries of usage having made it permanent.
Why doesn't the key advance over spaces?
By the classical convention this tool follows: the keystream is consumed by letters only, so word boundaries in the ciphertext sit exactly where they sat in the plaintext. Some implementations advance the key over every character including spaces; the two conventions produce different ciphertext, so if another tool disagrees with this one, check which convention it uses before doubting either.
How long must a Vigenère key be to be safe?
There is no safe short answer, because “safe” depends on message length: the column attack needs roughly 20 or more letters per key letter to score reliably, so a key nearly as long as the message starves it. But a long dictionary key still falls to a dictionary attack. True safety is the limiting case — a random key as long as the message, used once: the one-time pad.
What is the index of coincidence, in one sentence?
It is the probability that two letters drawn at random from a text are the same letter — about 0.067 for English, about 0.038 for random text — and it stays high inside a single Caesar alphabet while dropping when alphabets are mixed, which is what makes it a key-length detector.
Can the solver really recover a key I have lost?
For ordinary puzzle conditions — a keyword of modest length and a message of a sentence or more — yes: the Vigenère solver finds the length by IoC, solves the columns by frequency, and also tries dictionary keys. For very short messages it shows its ranked candidates honestly rather than pretending certainty.
Does my text leave my device?
No. The encoding, the tableau and the IoC hints all run in your browser.