Cipher Utility

Vigenère Cipher

C-02

Encrypt or decrypt with a keyword, letter by letter. Runs in your browser; nothing is sent anywhere.

Letter by letter

Each plain letter, the key letter used on it and the resulting cipher letter.

How to encrypt by hand

  1. Write the keyword under the message, repeating it.
  2. Turn each key letter into a shift: A is 0, B is 1.
  3. Shift each message letter forward by its key letter.
  4. To decrypt, shift back instead.

Worked example

ATTACK, key LEMON

Key repeated: LEMONL

A+L=L  T+E=X  T+M=F

ATTACK = LXFOPV

Further reading

Cipher Utility reference card Catalog no. C-02

What the Vigenère cipher is

The Vigenère cipher is a Caesar cipher with a different shift for each letter. The shifts come from a keyword: A means a shift of 0, B a shift of 1, and so on up to Z, a shift of 25. The keyword is repeated along the whole message, so with the key LEMON the first letter is shifted by 11, the second by 4, the third by 12, and the sixth by 11 again.

Message: ATTACKATDAWN Key: LEMONLEMONLE Cipher: LXFOPVEFRNHR

Because the same letter is shifted differently depending on where it falls, a plain letter count no longer reveals the message. That made the cipher far stronger than simple substitution.

The Vigenère square

The classic way to encrypt by hand is the Vigenère square, or tabula recta. Find the key letter's row and the message letter's column; the cipher letter is where they meet. To decrypt, go along the key letter's row to the cipher letter and read the column heading.

ABCDEFGHIJKLMNOPQRSTUVWXYZ
AABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZA
CCDEFGHIJKLMNOPQRSTUVWXYZAB
DDEFGHIJKLMNOPQRSTUVWXYZABC
EEFGHIJKLMNOPQRSTUVWXYZABCD
FFGHIJKLMNOPQRSTUVWXYZABCDE
GGHIJKLMNOPQRSTUVWXYZABCDEF
HHIJKLMNOPQRSTUVWXYZABCDEFG
IIJKLMNOPQRSTUVWXYZABCDEFGH
JJKLMNOPQRSTUVWXYZABCDEFGHI
KKLMNOPQRSTUVWXYZABCDEFGHIJ
LLMNOPQRSTUVWXYZABCDEFGHIJK
MMNOPQRSTUVWXYZABCDEFGHIJKL
NNOPQRSTUVWXYZABCDEFGHIJKLM
OOPQRSTUVWXYZABCDEFGHIJKLMN
PPQRSTUVWXYZABCDEFGHIJKLMNO
QQRSTUVWXYZABCDEFGHIJKLMNOP
RRSTUVWXYZABCDEFGHIJKLMNOPQ
SSTUVWXYZABCDEFGHIJKLMNOPQR
TTUVWXYZABCDEFGHIJKLMNOPQRS
UUVWXYZABCDEFGHIJKLMNOPQRST
VVWXYZABCDEFGHIJKLMNOPQRSTU
WWXYZABCDEFGHIJKLMNOPQRSTUV
XXYZABCDEFGHIJKLMNOPQRSTUVW
YYZABCDEFGHIJKLMNOPQRSTUVWX
ZZABCDEFGHIJKLMNOPQRSTUVWXY

History

Giovan Battista Bellaso described the cipher in 1553. It was later attributed to the French diplomat Blaise de Vigenère, and the name stuck. For about three hundred years it had a reputation as "le chiffre indéchiffrable", the indecipherable cipher. Charles Babbage broke it around 1854 without publishing, and Friedrich Kasiski published a general method in 1863. Our article on 300 years of unbreakable security tells the full story.

How it is broken

The weakness is the repeating key. If the key has five letters, every fifth letter is shifted by the same amount, so the message splits into five Caesar ciphers, each easy to solve with letter frequencies. Finding the key length is the hard part, and statistics like the index of coincidence do it reliably. The Vigenère decoder does the whole process automatically. Longer keys make it harder, and a key as long as the message that is never reused, a one-time pad, cannot be broken this way at all.

Questions about the Vigenère cipher

How do I decode a Vigenère cipher with the key?

Choose Decode, paste the ciphertext and type the keyword into the Key field. The tool shifts each letter back by the matching key letter. Only letters in the key count, so spaces and case in the key do not matter.

How do I decode it without the key?

Use the Vigenère decoder. It finds the key length with the index of coincidence and the Kasiski test, then recovers the key letter by letter. It needs a few sentences of text to work well.

What happens to spaces, numbers and punctuation?

They are copied unchanged and do not use up a key letter. Only the letters A to Z are shifted, and upper and lower case are kept.

Who invented the Vigenère cipher?

Giovan Battista Bellaso described it in 1553. It was later credited to Blaise de Vigenère, who wrote about a stronger autokey cipher in 1586, and his name stuck.

Is the Vigenère cipher secure?

No. It resisted attack for about three centuries, but Friedrich Kasiski published a general method to break it in 1863, and a computer does it in a fraction of a second.

Is my text sent to a server?

No. Encryption and decryption run in your browser with JavaScript, and nothing you type leaves your device.