Vigenère Cipher Encoder & Decoder

Encrypt and decrypt text with the classic Vigenère keyword cipher.

Only letters are used; non-letter characters are ignored. Effective key: KEY

Your result will appear here...
💡 Tip: The Vigenère cipher applies a different Caesar shift to each letter based on the keyword. Longer, less predictable keywords produce stronger encryption.

What is the Vigenère Cipher?

The Vigenère cipher is a polyalphabetic substitution cipher that uses a keyword to determine a different Caesar shift for each letter of the plaintext. Because the shift varies, simple frequency analysis no longer reveals the message at a glance.

For nearly three centuries the Vigenère cipher was considered unbreakable, earning the nickname “le chiffre indéchiffrable” (the indecipherable cipher), until Friedrich Kasiski published a general cryptanalysis method in 1863.

How the Vigenère Cipher Works

Encryption Process

  1. Choose a secret keyword (letters only).
  2. Repeat the keyword under the plaintext, letter by letter.
  3. For each plaintext letter, shift it by the position of the matching key letter (A=0, B=1, …, Z=25).
  4. Wrap around the alphabet using mod 26.

Example with keyword “KEY”:

Plaintext: HELLO WORLD
Key: KEYKE YKEYK
Ciphertext: RIJVS UYVJN

Mathematical Formula

Encryption: E(i) = (Pᵢ + Kᵢ) mod 26
Decryption: D(i) = (Cᵢ − Kᵢ + 26) mod 26
Pᵢ, Cᵢ, and Kᵢ are the i-th letters of the plaintext, ciphertext, and repeated key (0–25).

How to Break a Vigenère Cipher

1. Kasiski Examination

Look for repeated sequences in the ciphertext. The distance between repeats is often a multiple of the key length, narrowing down the possible key sizes.

2. Index of Coincidence

Compute the index of coincidence for different assumed key lengths; values close to 0.067 (the value for English) suggest the correct key length.

3. Frequency Analysis Per Column

Once the key length n is known, split the ciphertext into n columns and run frequency analysis on each column independently — each column is a simple Caesar cipher.

History of the Vigenère Cipher

The cipher is named after Blaise de Vigenère (1523–1596), although the autokey version he actually invented is stronger than the simpler repeated keyword method usually attributed to him. The repeating-key form was described earlier by Giovan Battista Bellaso in 1553.

It was widely used through the 18th and 19th centuries, including by the Confederate States during the American Civil War. Charles Babbage broke it privately around 1854, but the method was publicly credited to Friedrich Kasiski in 1863.

Practical Notes

Choosing a strong keyword:

  • Avoid short, common, or repeated-letter keywords.
  • The longer the key, the harder it is to break.
  • If the key is as long as the message and never reused, you have a one-time pad — the only mathematically unbreakable cipher.