About the Vigenère Cipher
This Vigenère cipher tool encrypts and decrypts text with a keyword. Each letter of your message is shifted along the alphabet by an amount set by the matching letter of the key — A shifts by 0, B by 1, up to Z by 25 — and the key repeats for the length of the message. Enter the same keyword to decrypt and the original text comes back.
It is popular with students learning classical cryptography, teachers running code-breaking lessons, puzzle and geocache designers, and escape-room builders. The letter-by-letter table shows the key stream and each shift, so you can follow or check the method by hand with a tabula recta.
Only the letters A–Z are encrypted; spaces, digits, punctuation and accented letters pass through unchanged and do not use up key letters, and capital letters keep their case. The autokey option uses the keyword once and then continues the key with the message itself, which removes the repeating pattern that makes the standard cipher breakable. Neither variant is secure by modern standards — use real encryption for anything sensitive.
How to use the vigenère cipher
- 1Type or paste the message.
- 2Enter a keyword — longer, non-repeating keys are harder to break.
- 3Choose encrypt or decrypt, and the standard or autokey variant.
- 4Copy the result, and use the table to follow the shift for each letter.
- 5Share the keyword separately so the recipient can decrypt the message.
Formula and method
Letters are numbered A = 0 to Z = 25. For the i-th letter of the message, the key letter Kᵢ is the keyword repeated as often as needed (standard variant), and the message letter is shifted forward by Kᵢ to encrypt or backward by Kᵢ to decrypt, wrapping around from Z to A. Only letters advance the key, so spaces and punctuation do not change the alignment.
In the autokey variant the keyword is used once and the key then continues with the plaintext itself, so the key never repeats. When decrypting, each recovered plaintext letter is appended to the key as soon as it is known. This is equivalent to looking up the row for the key letter and the column for the message letter in a 26 × 26 tabula recta.
- Pᵢ
- Plaintext letter value (A = 0 … Z = 25)
- Cᵢ
- Ciphertext letter value
- Kᵢ
- Key letter value for position i
Worked examples
The textbook example: ATTACK AT DAWN with LEMON
The keyword LEMON repeats as LEMONLEMONLE over the 12 letters. A + L (11) = L, T + E (4) = X, T + M (12) = F, and so on, giving "Lxfopv ef rnhr". Spaces are kept and capital letters keep their case.
Decrypting a message
Decryption shifts each letter back by the key letter: L − L = A, X − E = T, F − M = T (wrapping round the alphabet). The original plaintext ATTACKATDAWN returns.
Autokey variant
The key starts with QUEENLY and then continues with the plaintext itself (ATTAC), so it never repeats. Encrypting gives QNXEPVYTWTWP, the classic autokey example.
Removing spaces and punctuation
With "keep spaces and punctuation" off, the space characters, the digit and the exclamation mark are dropped. The eight remaining letters are shifted by K, E, Y repeating — M + K = W, e + E = i, e + Y = c, t + K = d — giving "Wicdqckx".
Frequently asked questions
How does the Vigenère cipher work?+
Each letter of the message is shifted by a different amount taken from a repeating keyword. With key LEMON the first letter shifts by 11 (L), the second by 4 (E), the third by 12 (M) and so on, so the same plaintext letter can encrypt to different ciphertext letters.
How do I decrypt a Vigenère cipher without the key?+
Find the key length first, using the Kasiski examination (distances between repeated sequences) or the index of coincidence, then solve each column as a Caesar cipher with letter-frequency analysis. Short messages with long keys are much harder to break.
Who invented the Vigenère cipher?+
The repeating-key method was described by Giovan Battista Bellaso in 1553 but was later misattributed to Blaise de Vigenère, who published a stronger autokey cipher in 1586. It was called "le chiffre indéchiffrable" until Charles Babbage and Friedrich Kasiski broke it in the 19th century.
Is the Vigenère cipher secure?+
No. It can be broken with pen-and-paper methods and is trivial for a computer. It is only safe for puzzles and teaching. A one-time pad — a truly random key as long as the message, never reused — is the only unbreakable version.
What is the difference between Vigenère and Caesar ciphers?+
A Caesar cipher shifts every letter by the same amount, so there are only 25 possible keys. Vigenère uses a sequence of shifts from a keyword; a Vigenère cipher with a one-letter key is exactly a Caesar cipher.