Skip to content
CodeShift
Menu

Vigenère Cipher — Encode & Decode with a Keyword

Enter a keyword, then type a message to encrypt it or paste ciphertext to decrypt it. Case, spaces and punctuation are preserved.

Standard: Classical polyalphabetic cipher (A–Z)Reviewed October 2026 · by The CodeShift DeskHow we translate
PlaintexttoCiphertext
Key alignment (first 40 letters)

How the Vigenère cipher works

The Vigenère cipher is a set of Caesar ciphers taken in turn. Each letter of the keyword gives a shift — A = 0, B = 1, … Z = 25 — and the keyword is repeated along the message. The first letter of the message is shifted by the first key letter, the second by the second, and so on. Because the same plaintext letter can turn into different ciphertext letters, simple letter-frequency counting does not work the way it does against a Caesar cipher.

Worked example: ATTACKATDAWN with the key LEMON

PlainATTACKATDAWN
KeyLEMONLEMONLE
Shift114121413114121413114
CipherLXFOPVEFRNHR

A shifted by L (11) gives L, T shifted by E (4) gives X, T shifted by M (12) gives F, and so on, producing LXFOPVEFRNHR — the classic textbook example. To decrypt, subtract each key shift instead of adding it.

The Vigenère square

Before calculators, people used a table of 26 shifted alphabets, the tabula recta. Find the plaintext letter along the top and the key letter down the side; the ciphertext letter is where they meet. A few rows of it:

AABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZA
CCDEFGHIJKLMNOPQRSTUVWXYZAB
DDEFGHIJKLMNOPQRSTUVWXYZABC
EEFGHIJKLMNOPQRSTUVWXYZABCD
LLMNOPQRSTUVWXYZABCDEFGHIJK
MMNOPQRSTUVWXYZABCDEFGHIJKL
NNOPQRSTUVWXYZABCDEFGHIJKLM
OOPQRSTUVWXYZABCDEFGHIJKLMN

Row L starts with L, so plaintext A under key L gives L — matching the first letter of the worked example.

Case, spaces and punctuation

This tool keeps the shape of your message: capitals stay capital, lowercase stays lowercase, and spaces, digits and punctuation pass through untouched. The key advances only on letters, which is the usual convention, so “Attack at dawn!” with the key LEMON becomes “Lxfopv ef rnhr!”. Some puzzle books strip spaces and write ciphertext in five-letter groups instead; the letters are the same either way. Non-letters in the key are ignored.

History

According to Encyclopaedia Britannica, the cipher was invented in 1553 by the Italian cryptographer Giovan Battista Bellaso, but for centuries was attributed to the French cryptographer Blaise de Vigenère, who devised a similar cipher in 1586. It earned the nickname le chiffre indéchiffrable — “the indecipherable cipher” — and was long believed to be unbreakable.

How it is broken

The weakness is the repeating key. In the 19th century Friedrich Kasiski showed that repeated fragments of ciphertext reveal the key length; once that is known, the message splits into several Caesar ciphers that can each be cracked by frequency analysis. Longer, random keys make this harder, and a truly random key as long as the message (a one-time pad) cannot be broken this way — but a short memorable keyword like LEMON offers little protection against a computer. Enjoy it for puzzles, geocaches and classroom work.

Related: Atbash cipher · A1Z26 letter-to-number cipher.

Decrypting step by step

To read LXFOPVEFRNHR with the key LEMON, line the key up under the ciphertext again and subtract each key shift: L − L (11 − 11) = 0 = A, X − E (23 − 4) = 19 = T, F − M (5 − 12 = −7, plus 26 = 19) = T, and so on, recovering ATTACKATDAWN. In the tool, paste the ciphertext into the lower box and type the key — decryption happens as you type.

Variants you may meet

  • Autokey. Britannica notes that Vigenère himself proposed following a short keyword with the plaintext itself, so the key never repeats. This tool implements the standard repeating-key cipher, not the autokey version.
  • Running key. A long passage from a book is used as the key instead of a short word.
  • Five-letter groups. Puzzle and historical ciphertexts often remove spaces and write the letters in blocks of five to hide word lengths.

Frequently asked questions

How does the Vigenère cipher work?+

Each letter of the message is shifted by the alphabet position of the matching key letter (A = 0, B = 1 … Z = 25), and the key repeats. With the key LEMON, ATTACKATDAWN becomes LXFOPVEFRNHR.

Does the key move forward on spaces and punctuation?+

No. In this tool the key only advances on letters, which is the usual convention, and case, spaces, digits and punctuation are kept. "Attack at dawn!" with the key LEMON becomes "Lxfopv ef rnhr!".

What if my key contains spaces or numbers?+

Only the letters of the key are used, so "le mon" works the same as LEMON. With no letters at all the text is left unchanged.

Who invented the Vigenère cipher?+

Encyclopaedia Britannica credits Giovan Battista Bellaso, who described it in 1553. It was later attributed to Blaise de Vigenère, who devised a similar (autokey) cipher in 1586.

Is the Vigenère cipher secure?+

Not by modern standards. Repeating keys leave patterns that Friedrich Kasiski showed how to exploit in the 19th century, and computers break short-key Vigenère ciphers easily. Use it for puzzles and learning.

Guides

More translators