SimplyCalculated.org

Vigenère Cipher Encoder & Decoder

Encrypt and decrypt with the Vigenère cipher — the polyalphabetic keyword cipher that was called "le chiffre indéchiffrable" for three centuries. Pick a key, type on either side, and watch the transformation happen live. Everything runs locally in your browser.

100% private: everything is processed in your browser's memory — nothing you enter is uploaded to a server, logged, or stored.

Vigenère Cipher

Only the letters A–Z in the key are used — case and digits are ignored. Non-letter characters in your message pass through unchanged and do not advance the key.

What Is the Vigenère Cipher?

The Vigenère cipher is a method of encrypting text with a keyword in which the shift applied to each letter changes as you move through the message. It belongs to the family of polyalphabetic substitution ciphers, because it uses not one but many substitution alphabets, selected in turn by the key. The first version was described by Giovan Battista Bellaso in 1553; Blaise de Vigenère published a more general form in 1586, and the cipher has carried his name ever since.

Its historical importance is hard to overstate. For roughly three hundred years the Vigenère cipher was regarded as practically unbreakable — "le chiffre indéchiffrable," the indecipherable cipher. It resisted the frequency-analysis techniques that had long since demolished simpler ciphers, because the same plaintext letter can encrypt to different ciphertext letters depending on where it falls in the message. It was not until the mid-1800s that Charles Babbage (in 1854, unpublished) and Friedrich Kasiski (in 1863, published) independently found systematic ways to break it, and those methods are the direct ancestors of the statistical cryptanalysis used today.

How the Vigenère Cipher Works

The cipher is best understood as a sequence of Caesar ciphers. Write the key repeatedly under the message, letter by letter (ignoring non-letters), then for each position add the plaintext letter and the key letter together modulo 26:

Operation Formula Meaning
Encrypt Cᵢ = (Pᵢ + Kᵢ) mod 26 Add the key letter to each plaintext letter
Decrypt Pᵢ = (Cᵢ − Kᵢ) mod 26 Subtract the key letter from each ciphertext letter

Here Kᵢ is the value of the key letter at position i (A = 0, B = 1, …, Z = 25), and "mod 26" wraps the result around the alphabet. When the message is longer than the key, the key simply starts over — a repetition that would eventually become the cipher's undoing. Non-letter characters are not encrypted and, importantly, do not consume a key position, so the key only advances over actual letters.

The Tabula Recta

Before computers, users applied the cipher with the tabula recta, a 26×26 table invented by Johannes Trithemius in the early 1500s. Row 0 is the alphabet in order; each row below it is shifted one position further left. To encrypt, find the plaintext letter's column and the key letter's row — their intersection is the ciphertext letter. To decrypt, find the ciphertext letter inside the key letter's row and read back up to the column header. The arithmetic in this tool is exactly the same operation, just without the paper.

Step-by-Step Example

The classic worked example encrypts "ATTACKATDAWN" with the key "LEMON". First write the key underneath, repeating it as needed:

Plaintext A T T A C K A T D A W N
Key L E M O N L E M O N L E
Value 11 4 12 14 13 11 4 12 14 13 11 4
Ciphertext L X F O P V E F R N H R

Take the first pair: A (0) plus L (11) equals 11, which is L. Then T (19) plus E (4) equals 23, which is X. Then T (19) plus M (12) equals 31, which wraps to 5, an F. Continuing produces LXFOPVEFRNHR — the famous example from every cryptography textbook. Enter it in the tool above with key LEMON to watch it decrypt back to ATTACKATDAWN.

Why "Indecipherable" Didn't Last

The cipher's fatal flaw is that the key eventually repeats. Modern breaking methods come in two steps. First, find the key length: the Kasiski examination looks for repeated strings in the ciphertext — repeated plaintext fragments (like "the") encrypted with the same key segment produce identical ciphertext fragments whose spacing reveals multiples of the key length. Alternatively, Friedman's index of coincidence measures the ciphertext's letter distribution statistically to estimate the key length. Second, once the length is known, take every k-th character as its own stream — each is a simple Caesar cipher with a fixed shift, and ordinary frequency analysis recovers each key letter. That two-step recipe works on any repeating-key cipher, which is why modern systems never reuse a key pattern and use ciphers like AES instead.

Ironically, Vigenère himself had also described an autokey variant in which the key extends itself with the plaintext instead of repeating — that version resists Kasiski-style attacks far better — but it was forgotten, and the repeating-key version carried his name into history.

Variants and Modern Relevance

Several close relatives share the Vigenère machinery. The Beaufort cipher encrypts as C = K − P and has the convenient property that encryption and decryption are identical. The autokey cipher extends the key with the message itself, eliminating the repetition weakness. A running key uses a long text (a book passage, say) as the key, which defeats periodicity at the cost of unwieldy key management. Wheatstone and Playfair took a different route entirely, encrypting letter pairs through a keyed square — you can try it on our Playfair Cipher Encoder & Decoder. None are used for modern security, but all of them — and the methods used to break them — remain the standard teaching material for how cryptanalysis works, and the cipher is a staple of puzzles, escape rooms, and capture-the-flag games.

Example Reference Table

Plain Text Key Ciphertext
ATTACKATDAWN LEMON LXFOPVEFRNHR
hello KEY rijvs
Hello, World! KEY Rijvs, Uyvjn!
SimplyCalculated TEAL LmmaecCleguwtxeo

Paste any plain-text value and its key into the tool to confirm the ciphertext matches, or paste ciphertext with the key to confirm it decodes back. Notice in the third row that spaces and punctuation survive untouched while only letters change.

Troubleshooting & Common Mistakes

My ciphertext will not decrypt back to my original text

Almost always a key mismatch: encryption and decryption must use the same key, letter for letter. Because only letters in the key count, "lemon" and "LEMON" are equivalent, but "lemons" is a different key entirely. Also check that the message was not altered in transit — a single changed letter produces exactly one wrong character on decrypt, which is a useful way to verify the key.

Why did my text come back with different capitalization?

Case is preserved position by position: the ciphertext "Rijvs, Uyvjn!" decrypts to "Hello, World!" with the exact original capitalization. If your result differs, the key letters used for those positions differ — revisit the key.

Can I encrypt numbers and symbols?

The classic Vigenère cipher only transforms A–Z letters; digits and symbols pass through unchanged (and, as always, do not advance the key). If you need to encrypt digits too, combine Vigenère with a second cipher that handles the rest of the character set.

Does a longer key make it more secure?

Against casual readers, yes — and against the classical attacks, a longer key is genuinely harder to crack. But because the key still repeats, it remains breakable by the two-step Kasiski/Friedman method no matter how long it is. Nothing in this family reaches modern cryptographic strength.

How This Cipher Compares to Other Classical Ciphers

Vigenère is one of several classical ciphers covered on this site — its polyalphabetic keyword approach is what let it outlast the single-shift Caesar cipher for centuries. The table below lines up its mechanism against the others, including the closely related Beaufort cipher.

Cipher Mechanism What Makes It Different
Caesar Cipher Substitution Shifts every letter by one fixed number (the key) through the alphabet — the simplest classical substitution cipher.
Atbash Cipher Substitution (fixed) A special case of substitution with no key at all — it always mirrors the alphabet (A↔Z, B↔Y, ...).
Vigenère Cipher (this page) Polyalphabetic substitution Repeats a keyword to shift each letter by a different amount, defeating simple frequency analysis that breaks Caesar.
Beaufort Cipher Polyalphabetic substitution (reciprocal) A variant of Vigenère's idea that is self-reciprocal — the same operation both encrypts and decrypts.
Playfair Cipher Digraph substitution Encrypts letters two at a time using their positions in a 5×5 key square — the first practical digraph cipher (1854).
Affine Cipher Mathematical substitution Encrypts using a linear function (ax + b mod 26) with two keys instead of one shift value.
ROT47 Substitution (extended range) Applies a Caesar-style shift across the full printable ASCII range, not just letters — used to obfuscate text online (e.g. spoilers), not for security.
Rail Fence Cipher Transposition Rearranges letter order in a zigzag pattern instead of substituting letters — a fundamentally different technique from every cipher above.
A1Z26 Encoding (not a cipher) Simply maps each letter to its position number (A=1...Z=26) — a puzzle/encoding convention, not intended for real secrecy.
NATO Phonetic Alphabet Encoding (not a cipher) Replaces each letter with a spoken code word (Alfa, Bravo, Charlie…) for reliable voice transmission on noisy radios — built for clarity, not secrecy.

Frequently Asked Questions

Is the Vigenère cipher secure enough for real encryption?
No. For about three centuries it was known as "le chiffre indéchiffrable" — the indecipherable cipher — but the mystery ended in the 1850s and 1860s, when Charles Babbage and Friedrich Kasiski independently published systematic breaks. Modern attacks exploit the fact that the key repeats: once the key length is found (via the Kasiski examination or Friedman's index of coincidence), the cipher splits into separate Caesar ciphers that fall to frequency analysis. Today the Vigenère cipher is a learning tool and puzzle cipher, not a security mechanism — use AES or another modern standard for anything sensitive.
How do I choose a good key?
The key length is the cipher's real strength: a longer key means the pattern repeats less often, which makes the ciphertext harder to analyze. Avoid single-letter keys (that is just a Caesar cipher), avoid obvious words like "password", and remember that the key determines everything — if you lose it, you cannot decrypt your message. Even the best key only delays a determined analyst, because the repeated pattern is still discoverable.
Why is "le chiffre indéchiffrable" written in French?
The cipher's history is European. Giovan Battista Bellaso described the first version in 1553, and Blaise de Vigenère published a more general form in 1586 — but because Vigenère's name was attached to it, the "indecipherable cipher" nickname and most early literature are French. The name stuck even though Vigenère himself actually proposed an even stronger autokey variant that, ironically, went unnoticed for centuries.
What happens if I type a key with digits or spaces in it?
Only the letters A–Z in the key are used — case, digits, spaces, and punctuation are ignored. "L3M0N!", "lemon", and "LEMON" are all treated as the same key. If the key contains no letters at all, the cipher becomes the identity: text passes through unchanged, since a key of length zero cannot shift anything.
How is the Vigenère cipher different from the Caesar cipher?
A Caesar cipher uses one fixed shift for every letter, so the ciphertext betrays the plaintext's letter frequencies and is trivial to brute force. The Vigenère cipher changes the shift from letter to letter, cycling through the key — the same plaintext letter can encrypt to many different ciphertext letters depending on its position. That single change defeats simple frequency analysis and is exactly why the cipher was considered unbreakable for so long.
What is the tabula recta?
The tabula recta is a 26×26 table invented by Johannes Trithemius in the 1500s: each row is the alphabet shifted by one more position. To encrypt by hand with a key, you take the plaintext letter's column and the key letter's row and read off the intersection. To decrypt, you find the ciphertext letter in the key letter's row and read back up to the column. This tool does the same arithmetic internally — the table is just the classic way of doing it with paper and pencil.
Does this tool send my message anywhere?
No. All encryption and decryption happens entirely in your browser — nothing you type or encrypt is uploaded, logged, or stored. You can safely test confidential text here. Just remember the Vigenère cipher itself is a historical and educational cipher, not a confidentiality guarantee for anything important.

Formula last verified August 29, 2026 against our published methodology .