Vigenère cipher

What is a Vigenere Cipher?

The Vigenère cipher is a classical polyalphabetic substitution cipher from the 16th century. Instead of shifting every letter by the same amount, as the Caesar cipher does, it uses a keyword to shift each letter by a different amount. For about 300 years it was called le chiffre indéchiffrable, the indecipherable cipher. Today it is a favourite for teaching cryptography, puzzles and escape rooms.

How to use it

  1. Enter the text.
  2. Enter the keyword.
  3. Choose encrypt or decrypt and read the result.

How it works

Each letter of the keyword gives a shift: A = 0, B = 1, ... Z = 25. The keyword is repeated along the message, and each plaintext letter is shifted by the corresponding keyword letter. Decryption shifts backwards.

Worked example

Plaintext ATTACKATDAWN with keyword LEMON (repeated as LEMONLEMONLE):

  • A + L(11) = L
  • T + E(4) = X
  • T + M(12) = F
  • A + O(14) = O
  • C + N(13) = P

The full ciphertext is LXFOPVEFRNHR. Decrypting it with LEMON returns the original.

How it was broken

Because the keyword repeats, the cipher is really several Caesar ciphers interleaved. In 1863 Friedrich Kasiski published a method of finding the key length from repeated sequences in the ciphertext; once the length is known, each position is solved with simple frequency analysis. The Friedman test (index of coincidence) estimates the key length statistically.

Security note

Vigenère is not secure for real secrets. Use it for education and puzzles; use AES for actual data protection.

Frequently Asked Questions

How does the Vigenère cipher differ from the Caesar cipher?

Caesar shifts every letter by the same amount. Vigenère uses a keyword so different letters are shifted by different amounts.

Is the Vigenère cipher secure?

No. It can be broken with the Kasiski examination and frequency analysis, especially for long messages.

What happens to spaces and punctuation?

Usually they are left unchanged and do not consume keyword letters, though conventions differ between implementations.

What is a running key cipher?

A Vigenère variant where the key is as long as the message, such as text from a book, which removes the repeating pattern.