Vigenère Cipher
Encode and decode Vigenère, autokey and Beaufort ciphers, with key-length analysis for breaking one.
The Vigenère Cipher runs entirely in your browser. Your text and key are processed on your device and never uploaded.
Try the Caesar cipher
About Vigenère Cipher
Vigenère repeats a keyword across a message and shifts each letter by its matching key letter, which gives one plaintext letter many possible ciphertext letters and defeats the frequency analysis that breaks a plain Caesar shift. It held up for three centuries and was called le chiffre indéchiffrable for most of them. This tool runs it in both directions, keeps case and punctuation intact, and offers the two variants that come up most often: autokey, which extends the key with the plaintext so it never repeats, and Beaufort, which subtracts instead of adding and so is its own inverse. For a ciphertext with no key, index-of-coincidence analysis suggests likely key lengths.
Features
- Encode and decode with any keyword, case and punctuation preserved
- Autokey and Beaufort variants alongside the classic cipher
- Key-length analysis from the index of coincidence of each column
- Letter frequency breakdown of the text
- Optional grouping into blocks of five, the classical telegraph convention
- Shows the keystream actually applied to the message
- The full 26-row Vigenère tableau for working by hand
How to use the Vigenère Cipher
- Paste the text and enter a keyword
- Pick encode or decode, and a variant if you need one
- Read the result, with the keystream shown beneath it
- For an unknown key, switch to decode and check the suggested key lengths
Example
Input
ATTACKATDAWN with the key LEMON
Output
LXFOPVEFRNHR
The textbook example: each letter shifted by the key letter repeating above it.
Common errors & troubleshooting
- Decoding gives readable text at the start and gibberish after. — The key is right but the variant is wrong. Classic Vigenère repeats the key, while autokey continues it with the plaintext, so the two agree only for the first few letters.
- The result does not match another tool's output. — Check how non-letters are treated. Here punctuation is passed through and does not consume a key letter, which is the usual convention — some implementations advance the key on every character.
- The key-length analysis suggests a multiple of the real length. — That is expected. Columns at twice the key length are just as consistent, so the shortest strong candidate is usually the answer.
- Beaufort decoding seems to do nothing different from encoding. — It should not. Beaufort is its own inverse, so running it twice returns the original text and the direction selector makes no difference.
Frequently asked questions
- How does the Vigenère cipher work?
- The keyword is repeated along the message, and each letter is shifted forward by the alphabet position of the key letter above it. A key letter of B shifts by one, C by two, and so on, wrapping at Z.
- Can a Vigenère cipher be broken without the key?
- Yes. Once the key length is known — from repeated patterns or from index of coincidence — the ciphertext splits into columns, each of which is a plain Caesar shift open to frequency analysis. Kasiski published the method in 1863.
- What is the index of coincidence used for here?
- It measures how often two letters picked at random from the text match. English sits near 0.067 and random text near 0.038, so the candidate key length whose columns score highest is very likely the real one.
- How is the autokey variant different?
- Instead of repeating the keyword, it continues the key with the plaintext itself. The key never repeats, which removes the periodic structure that Kasiski examination relies on and makes the cipher considerably harder.
- Is the Vigenère cipher secure today?
- Not at all. It falls to a few lines of analysis and is a puzzle or a teaching example, not protection. Anything that has to stay private needs modern authenticated encryption such as AES-GCM.
Related tools
All ArrayKit tools