Vigenère Cipher

Encode and decode text with the Vigenère polyalphabetic substitution cipher

What is it and how does it work?

The Vigenère cipher is a polyalphabetic substitution cipher that uses a keyword to apply multiple Caesar shifts to plaintext. For the keyword "KEY" (K=10, E=4, Y=24): the 1st letter is shifted by 10, the 2nd by 4, the 3rd by 24, the 4th again by 10, cycling through the keyword. This eliminates the single-frequency-analysis weakness of Caesar cipher — the same plaintext letter encrypts differently depending on its position. Invented in the 16th century and attributed to Blaise de Vigenère (though earlier forms existed), it was considered unbreakable for three centuries and dubbed "le chiffre indéchiffrable" (the indecipherable cipher).

Despite its historical reputation, Vigenère cipher is broken by Kasiski examination (finding repeated ciphertext sequences to determine key length) followed by frequency analysis on each shift position separately. This tool encrypts and decrypts Vigenère cipher with configurable keywords, shows the encryption table, and demonstrates the key repetition pattern — essential for understanding both how the cipher works and why it falls to cryptanalysis.

Common use cases

Frequently asked questions

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

Caesar cipher uses a single constant shift for all letters. Vigenère uses a keyword where each letter defines a different shift, cycling through the keyword. With keyword "CAT" (C=2, A=0, T=19): position 1 shifts by 2, position 2 shifts by 0 (no change), position 3 shifts by 19, then repeats. This means the same plaintext letter can produce different ciphertext letters depending on its position, defeating simple frequency analysis.

What is Kasiski examination?

Kasiski examination (1863) discovers the key length of a Vigenère cipher by finding repeated sequences in the ciphertext. If a 3-letter sequence "XYZ" appears at positions 15 and 45, the distance is 30. The key length is likely a factor of 30 (1, 2, 3, 5, 6, 10, 15, 30). Finding multiple such repetitions and taking the GCD of their distances gives the probable key length. Once key length n is known, the ciphertext is split into n separate Caesar ciphers, each breakable by frequency analysis.

What is the One-Time Pad and how is it related to Vigenère?

The One-Time Pad (OTP) is a Vigenère cipher with a key as long as the message, used only once, and chosen truly randomly. The OTP is provably unbreakable (Shannon, 1949) — with a truly random key of equal length, every plaintext is equally likely for any ciphertext. Vigenère's weakness is the repeating key — if the key were as long as the message and used only once, it would be a One-Time Pad. The OTP is impractical for most uses because of the key distribution problem.

What is the Beaufort cipher?

The Beaufort cipher is a variant of Vigenère where the encryption formula is reversed: Cᵢ = (Kᵢ - Pᵢ) mod 26 (instead of Vigenère's (Pᵢ + Kᵢ) mod 26). The Beaufort cipher has the property of being "reciprocal" — the same operation encrypts and decrypts (like ROT13 for Caesar). The Autokey cipher is another variant where the key starts with a keyword and then uses the plaintext itself as the continuing key — this defeats Kasiski examination.

Security

Password Strength Checker · ROT13 Cipher · Base32 Encoder / Decoder · Hex Encoder / Decoder · Caesar Cipher · Atbash Cipher