Vigenère cipher
A repeating keyword picks a different Caesar shift for each letter.
- Family
- Polyalphabetic substitution
- Era
- 1553 (Bellaso), named after Vigenère
- Keys
- 26ⁿ for a key of n letters
Giovan Battista Bellaso described this cipher in 1553; it was later credited to Blaise de Vigenère. For three centuries it was called le chiffre indéchiffrable, the indecipherable cipher.
Each letter of the keyword gives a Caesar shift (A = 0, B = 1 … Z = 25). The keyword repeats along the message, so the same plaintext letter can encrypt to different ciphertext letters.
01 / 12 · Inside the Vigenère cipher
A message to hide
This readable text is the plaintext. Encrypting turns it into ciphertext. Classical ciphers only touch letters.
The goal: whoever intercepts the ciphertext must not get back to these letters.
Playground
Encrypt with your own keyword
Type a message and a keyword, then step through: each letter is shifted by the key letter under it. The panel on the right does the sum for each of your letters.
Your input
Only the letters A–Z count.
Lxfopv ef rnhr
Encrypt
5 Caesar shifts taking turns
What happens
Each keyword letter stands for a shift: A = 0, B = 1 … Z = 25. The keyword is written again and again under the message, and each letter is shifted by the key letter below it.
On your values
L=11 E=4 M=12 O=14 N=13
C = (P + K) mod 26
Why it matters
Changing the shift from letter to letter hides which plain letters are common. But the keyword repeats every 5 letters: that period is the crack Kasiski published in 1863 (see below).
Spaces, digits and punctuation pass through unchanged; accents are dropped.
The basics: Modular arithmetic →Start
← → to step · space to playHow it’s broken
Find the key length, then solve one Caesar cipher per column
Words that repeat in the message sometimes meet the same key letters, so the same cipher fragment appears twice. The distance between the two copies is a multiple of the key length (Friedrich Kasiski, 1863). Once the length is known, every column of letters is a plain Caesar cipher, broken by letter frequencies.
Repeated fragments and their distance
No fragment of 3 or more letters repeats in this ciphertext: the method needs a longer text. Try the long-text preset.
How many distances each key length divides
The ciphertext’s letter counts are flatter than the language’s: no bar stands out the way E does, so a single frequency count fails.
Column j holds letters j, j + 5, j + 10…; each one was shifted by a single key letter. The best Caesar shift of each column:
- j=0H = 7
- j=1E = 4
- j=2B = 1
- j=3K = 10
- j=4W = 22
- Recovered key
- HEBKW
Decrypted with it
Eteeto ae hran
Short texts can fool the statistics: the longer the ciphertext, the surer the attack. Try the long-text preset.
How it works
- 1Write the keyword repeatedly under the plaintext letters, skipping spaces and punctuation.
- 2In the tabula recta, go to the row of the key letter and the column of the plaintext letter.
- 3The letter where they cross is the ciphertext letter.
- 4To decrypt, find the ciphertext letter in the key letter's row; its column heading is the plaintext letter.
Formula
Cᵢ = (Pᵢ + Kᵢ mod n) mod 26 Pᵢ = (Cᵢ − Kᵢ mod n) mod 26
How it is broken
The key repeats. Charles Babbage and later Friedrich Kasiski (1863) found that repeated fragments in the ciphertext reveal the key length.
Once the key length n is known, every n-th letter was encrypted with the same Caesar shift, and each of those groups falls to frequency analysis.