Vigenere Cipher Encoder / Decoder

Encode or decode text using the Vigenere cipher with any keyword.
A polyalphabetic substitution cipher stronger than Caesar cipher.

Vigenere Result

What Is the Vigenere Cipher? The Vigenere cipher is a polyalphabetic substitution cipher invented by Giovan Battista Bellaso in 1553 in Italy, though it was misattributed to Blaise de Vigenere and bears his name. It uses a keyword to shift each letter by a different amount, making it much harder to break than a simple Caesar cipher.

How It Works Each letter of the keyword determines the shift for the corresponding letter of the plaintext. If the keyword is “KEY”, then the first letter is shifted by K=10, the second by E=4, the third by Y=24, then the pattern repeats. The formula is: Cipher_i = (Plain_i + Key_i) mod 26.

Example Plaintext: HELLO. Keyword: KEY (repeats as KEYKE). H+K(10)=R, E+E(4)=I, L+Y(24)=J, L+K(10)=V, O+E(4)=S. Result: RIJVS.

To Decode Subtract instead of add: Plain_i = (Cipher_i - Key_i) mod 26. Using the same keyword, RIJVS decodes back to HELLO.

Historical Significance The Vigenere cipher was considered unbreakable for nearly 300 years, and the French called it “le chiffre indechiffrable” - the indecipherable cipher. In 1863, Friedrich Kasiski published a method to break it by finding repeated sequences in the ciphertext to work out the keyword length. Once the keyword length is known, each position can be attacked as a separate Caesar cipher using frequency analysis.

Strength vs Caesar Cipher A Caesar cipher has only 25 possible keys. The Vigenere cipher has 26^n possible keys where n is the keyword length. A 10-letter keyword gives over 141 trillion possible keys. However, it is still vulnerable to Kasiski examination and the Friedman test.

Why the letter chart matters

Under the result you get a bar chart of letter frequencies before and after. That picture is the whole reason this cipher held up for three centuries, and it is also how it eventually fell.

English is lopsided. E turns up in about 12% of letters, T around 9%, while Z and Q barely register. A Caesar cipher just slides that shape sideways: the tallest bar moves, but it is still the tallest bar, and anyone who counts letters finds the shift in a minute. A Vigenere key of length n splits the message into n separate Caesar ciphers, and the peaks of those n different shifts land on different letters and cancel each other out. The longer the key, the flatter the output.

There is a number for how flat it is, called the index of coincidence: the chance that two letters picked at random from the text are the same letter. English sits near 0.067. Uniformly random text sits at 1/26, or 0.038. The calculator prints both values for your text, and you can watch the output figure fall toward 0.038 as you lengthen the key.

That measurement is exactly what William Friedman turned into an attack in 1922. Chop the ciphertext into every n-th letter for n = 1, 2, 3 and so on; whichever n gives slices with an index of coincidence back up around 0.067 is your key length. After that the cipher is just a stack of Caesar shifts, and it falls apart.

One warning that is easy to miss: a one-letter key is not a Vigenere cipher at all. It is a plain Caesar shift, the chart barely changes shape, and it offers no real protection. Short keys on long messages are nearly as bad, because the key repeats often enough for Kasiski’s method to spot it. None of this is secure by modern standards. Use it for puzzles, geocaching clues, and escape rooms, not for anything you actually need to keep.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.