Vigenère Cipher Decoder — How to Encode and Decode Step by Step
By Letters2NumbersConverter.com · May 13, 2026
The Vigenère cipher is the most famous polyalphabetic substitution cipher and one of the most searched classical ciphers after the Caesar cipher. Once called “le chiffre indéchiffrable” (the indecipherable cipher), it was the gold standard of secret communication for three centuries — until Charles Babbage cracked it in the 1850s. This guide explains exactly how encoding and decoding works, with a full worked example, the Vigenère square, and a method for breaking it without the key. To decode or encode text right now, try our free Cipher Identifier or Playfair Cipher Solver for related classical ciphers.
What Is the Vigenère Cipher?
The Vigenère cipher is a polyalphabetic substitution cipher — it uses multiple Caesar shifts instead of just one. The key is a word or phrase; each letter of the key determines the shift applied to the corresponding letter of the plaintext. When the key is shorter than the message, it simply repeats.
For example, with key KEY:
- K = shift 10 (K is the 11th letter, 0-indexed = 10)
- E = shift 4
- Y = shift 24
- Then the key cycles: K, E, Y, K, E, Y, …
Because the same plaintext letter (say, E) can map to three different ciphertext letters depending on which key letter aligns with it, simple letter-frequency analysis fails — the reason the cipher stumped cryptanalysts for so long.
How to Encode with the Vigenère Cipher
Formula: C = (P + K) mod 26, where P is the plaintext letter's position (A=0 … Z=25) and K is the key letter's position.
Worked Example — Encoding “CRYPTOGRAPHY” with key “KEY”
| Plaintext | Key letter | Plain pos (P) | Key pos (K) | (P+K) mod 26 | Ciphertext |
|---|---|---|---|---|---|
| C | K | 2 | 10 | (2+10) mod 26 = 12 | M |
| R | E | 17 | 4 | (17+4) mod 26 = 21 | V |
| Y | Y | 24 | 24 | (24+24) mod 26 = 22 | W |
| P | K | 15 | 10 | (15+10) mod 26 = 25 | Z |
| T | E | 19 | 4 | (19+4) mod 26 = 23 | X |
| O | Y | 14 | 24 | (14+24) mod 26 = 12 | M |
| G | K | 6 | 10 | (6+10) mod 26 = 16 | Q |
| R | E | 17 | 4 | (17+4) mod 26 = 21 | V |
| A | Y | 0 | 24 | (0+24) mod 26 = 24 | Y |
| P | K | 15 | 10 | (15+10) mod 26 = 25 | Z |
| H | E | 7 | 4 | (7+4) mod 26 = 11 | L |
| Y | Y | 24 | 24 | (24+24) mod 26 = 22 | W |
Result: CRYPTOGRAPHY → MVWZXMQVYZLW
How to Decode the Vigenère Cipher
Formula: P = (C − K + 26) mod 26. Subtract the key letter's position from the ciphertext letter's position (adding 26 to avoid negative numbers), then take mod 26.
Worked Example — Decoding “MVWZXMQVYZLW” with key “KEY”
| Ciphertext | Key letter | Cipher pos (C) | Key pos (K) | (C−K+26) mod 26 | Plaintext |
|---|---|---|---|---|---|
| M | K | 12 | 10 | (12−10+26) mod 26 = 2 | C |
| V | E | 21 | 4 | (21−4+26) mod 26 = 17 | R |
| W | Y | 22 | 24 | (22−24+26) mod 26 = 24 | Y |
| Z | K | 25 | 10 | (25−10+26) mod 26 = 15 | P |
| X | E | 23 | 4 | (23−4+26) mod 26 = 19 | T |
| M | Y | 12 | 24 | (12−24+26) mod 26 = 14 | O |
| Q | K | 16 | 10 | (16−10+26) mod 26 = 6 | G |
| V | E | 21 | 4 | (21−4+26) mod 26 = 17 | R |
| Y | Y | 24 | 24 | (24−24+26) mod 26 = 0 | A |
| Z | K | 25 | 10 | (25−10+26) mod 26 = 15 | P |
| L | E | 11 | 4 | (11−4+26) mod 26 = 7 | H |
| W | Y | 22 | 24 | (22−24+26) mod 26 = 24 | Y |
Decoded result: MVWZXMQVYZLW → CRYPTOGRAPHY ✓
The Vigenère Square (Tabula Recta)
The Vigenère square is a 26×26 grid that makes manual encoding and decoding easier — no arithmetic needed. The rows are labelled by key letter (A–Z) and the columns by plaintext letter (A–Z).
- To encode: find the row for the key letter, find the column for the plaintext letter — the cell is the ciphertext letter.
- To decode: find the row for the key letter, scan along that row to find the ciphertext letter — the column header is the plaintext letter.
| ↓key/plain→ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| B | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A |
| C | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B |
| D | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
| E | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D |
| F | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E |
| G | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F |
| H | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G |
| I | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H |
| J | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I |
| K | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J |
| L | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K |
| M | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L |
| N | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M |
| O | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N |
| P | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
| Q | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
| R | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q |
| S | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R |
| T | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S |
| U | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T |
| V | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U |
| W | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V |
| X | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W |
| Y | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X |
| Z | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y |
Highlighted cell (row K, col C): M — encoding C with key letter K gives M. ✓ (matches our worked example above)
How to Crack the Vigenère Cipher Without the Key
Breaking the Vigenère cipher is a two-step process: first find the key length, then crack each sub-cipher independently.
Step 1 — Find the Key Length (Kasiski Examination)
Scan the ciphertext for repeated sequences of 3 or more characters. When the same sequence appears multiple times, the distance between occurrences is often a multiple of the key length. Find the GCD of all these distances — that's your likely key length.
Example:if “XKM” appears at positions 14 and 44, the gap is 30. If it also appears at position 74 (gap 30 again), the key length is likely a factor of 30 — so 2, 3, 5, 6, 10, 15, or 30. English words tend to be 3–8 letters, so 5 or 6 are the best guesses.
Step 2 — Crack Each Sub-Cipher with Frequency Analysis
Once you know the key length (say, 5), split the ciphertext into 5 sub-streams: characters at positions 0, 5, 10, … then 1, 6, 11, … and so on. Each sub-stream is a simple Caesar cipher. Apply frequency analysis to each — the most common letter in English text is E (12.7%), so the most frequent ciphertext letter in each stream likely corresponds to E. The difference gives you each key letter.
Our Text Frequency Analysis tool can help you analyse letter distributions quickly.
More Vigenère Cipher Examples
| Plaintext | Key | Ciphertext |
|---|---|---|
| HELLO WORLD | SECRET | ZINCS PGVNU |
| ATTACK AT DAWN | LEMON | LXFOPV EF RNHR |
| THE QUICK BROWN FOX | CIPHER | VPT XYZES QYSNP NDE |
| ESCAPE ROOM PUZZLE | MAZE | QSBEBE QSAM OYLZKI |
| VIGENERE IS STRONG | BABBAGE | WIHFNKVF IT TTXSOG |
Vigenère vs. Caesar — Key Differences
| Feature | Caesar Cipher | Vigenère Cipher |
|---|---|---|
| Type | Monoalphabetic | Polyalphabetic |
| Key | Single number (1–25) | Word or phrase |
| Same letter maps to | Same ciphertext always | Different ciphertext each position |
| Crack with frequency analysis? | Yes — trivially | Not directly |
| Key space | 25 possibilities | Millions (depends on key length) |
| Practical security | None | None (broken 1863) |
Frequently Asked Questions
What is the Vigenère cipher?
The Vigenère cipher is a polyalphabetic substitution cipher that uses a repeating keyword to shift each letter of the plaintext by a different amount. Each letter of the key determines the shift for the corresponding letter of the message, making it significantly harder to crack than the Caesar cipher.
How do I decode a Vigenère cipher without the key?
Use Kasiski examination to estimate the key length (look for repeated 3-letter sequences and take the GCD of their spacings), then apply frequency analysis to each Caesar sub-cipher. The most common ciphertext letter in each position likely encodes E — the difference gives you each key letter.
What is the Vigenère square?
The Vigenère square (tabula recta) is a 26×26 grid where each row is the alphabet shifted by one position. To encode, find the row for the key letter and the column for the plaintext letter — their intersection is the ciphertext letter. To decode, find the ciphertext letter in the key letter's row; the column header is the plaintext letter.
How is the Vigenère cipher different from the Caesar cipher?
The Caesar cipher uses a single fixed shift for every letter — the same letter always produces the same ciphertext, making frequency analysis trivial. The Vigenère cipher uses a keyword so each letter is shifted differently, meaning the same plaintext letter produces different ciphertext letters at different positions. This defeats simple frequency analysis.
Is the Vigenère cipher secure?
No — it was broken in the 19th century using Kasiski examination and Friedman's Index of Coincidence. Modern encryption (AES, RSA, ChaCha20) is computationally infeasible to crack and should be used for any real security requirement.
Explore More Cipher Tools
The Vigenère cipher is one of many classical ciphers worth learning. Try these free tools on our site:
- Caesar Cipher Decoder — brute-force all 25 shifts instantly
- Playfair Cipher Solver — digraph substitution cipher
- Atbash Cipher Decoder — mirror alphabet substitution
- ROT13 Decoder — Caesar shift 13
- Cipher Identifier — detect which cipher was used
- Text Frequency Analysis — analyse letter distributions
- Monoalphabetic Substitution Cipher — custom alphabet mappings