The Vigenère cipher
The Vigenère cipher is one of the most famous hand ciphers ever invented. For roughly three hundred years it was considered unbreakable — so much so that it earned the nickname le chiffre indéchiffrable, "the indecipherable cipher." Even today, it remains a elegant introduction to polyalphabetic encryption and a practical way to hide a message from casual readers.
A brief history
The cipher was first described in 1553 by the Italian cryptologist Giovan Battista Bellaso. Decades later it was misattributed to the French diplomat Blaise de Vigenère, and the wrong name stuck.
Unlike the simple Caesar cipher — which shifts every letter by the same amount — the Vigenère cipher uses a keyword to change the shift from letter to letter. That small change made it far more resistant to the frequency-analysis attacks that easily broke monoalphabetic ciphers.
It was used across Europe for diplomatic correspondence, saw use during the American Civil War, and remained a classroom and field cipher long after more advanced systems took over.
Why it is polyalphabetic
A monoalphabetic cipher replaces every instance of a letter with the same substitute. If E always becomes H, an attacker can count letter frequencies and quickly spot that H is probably E.
The Vigenère cipher is polyalphabetic: the same plaintext letter can be encoded many different ways depending on where it appears in the message. The keyword repeats underneath the plaintext, and each letter of the keyword decides the shift for the plaintext letter above it.
The result is a Vigenère ciphertext that hides the underlying letter frequencies of the original message. Without the keyword, decryption is much harder than with a simple substitution.
How the Vigenère cipher works
Encryption follows three simple rules:
- Write the plaintext in a row.
- Write the keyword underneath, repeating it until it matches the length of the message.
- For each column, shift the plaintext letter forward through the alphabet by the keyword letter's position.
In the alphabet, A = 0, B = 1, … Z = 25. To encrypt, add the two values and wrap around if the total exceeds 25. To decrypt, subtract the keyword value instead.
Step-by-step example
Let us encrypt the message ATTACK AT DAWN with the keyword RAVEN.
| Plaintext | A | T | T | A | C | K | A | T | D | A | W | N |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Key | R | A | V | E | N | R | A | V | E | N | R | A |
| Shift | +17 | +0 | +21 | +4 | +13 | +17 | +0 | +21 | +4 | +13 | +17 | +0 |
| Ciphertext | R | T | O | E | P | B | A | O | H | N | N | N |
Vigenère ciphertext: RTOEPBAOHNNN
Look closely at the plaintext letter A. It becomes R, E, A, H, and N at different positions. That variation is exactly what makes the cipher stronger than a simple Caesar shift.
To decrypt, the recipient writes the same keyword under the ciphertext and subtracts each keyword value. With RAVEN in hand, the original message reappears.
Strengths and weaknesses
The Vigenère cipher's main strength is its polyalphabetic nature. Because the shift changes with every letter, basic frequency analysis no longer works directly.
Its weaknesses are practical: if the keyword is short, an attacker can guess its length and break the message into simpler Caesar ciphers. A long, random keyword — ideally as long as the message itself — makes the cipher much stronger. In fact, a truly random keyword used only once is the basis of the unbreakable one-time pad.
Try the Vigenère cipher
Encode and decode your own Vigenère messages instantly in the Nullcode app. No accounts, no servers, no trace — everything runs in your browser.
Open the cipher tool