Skip to content

Vigenère Cipher Encoder & Decoder

Encipher or decipher a message with the Vigenère cipher by entering a keyword. Each letter is shifted by the matching key letter, case is kept, and anything that isn't a letter passes through. Switch on the working table to see the key letter and shift for each of the first 20 letters. Free, no sign-up, and nothing is uploaded.

Mode

How to Use the Vigenère Cipher Tool

  1. 1. Choose Encode or Decode. Encode turns plain text into cipher text; Decode reverses it with the same keyword.
  2. 2. Enter the keyword. Letters A–Z only, no spaces or digits. The keyword repeats along the message. A keyword of a shifts by zero and changes nothing.
  3. 3. Type or paste the message. The result updates as you type. Case is preserved, and digits, spaces and punctuation pass through without using up a key letter.
  4. 4. Tick Show working for a table of the plain letter, key letter, shift and result for the first 20 letters.

How the Vigenère Cipher Works

Number the letters A = 0 to Z = 25. Write the keyword repeatedly under the message, one key letter per message letter. To encipher, add each key letter's number to the message letter's number, wrapping past Z: C = (P + K) mod 26. To decipher, subtract: P = (C − K) mod 26. Each key letter therefore picks a different Caesar shift — A for 0, B for 1, up to Z for 25 — which is why the cipher is called polyalphabetic: the same message letter can become different cipher letters. Writing the sums by hand is what the traditional Vigenère square (tableau) speeds up.

Worked Example: Keyword LEMON

Encoding Attack at dawn with the keyword lemon gives Lxfopv ef rnhr. The first six letters, as the working table shows them:

Plain letterKey letterShiftResult
Al+11L
te+4x
tm+12f
ao+14o
cn+13p
kl+11v

Look at the repeats. The two ts of "Attack" become x and f, because they sit under different key letters, and the two as become o and e. A plain Caesar shift would have turned each pair into identical letters, which is exactly the pattern frequency analysis exploits. Decoding uses the same table in reverse: Decode mode with lemon turns Lxfopv ef rnhr back into Attack at dawn. The key letters run on across the space; the space itself uses none.

A Short History

Giovan Battista Bellaso described this cipher in 1553. The name comes from Blaise de Vigenère, who in 1586 published a related but stronger autokey cipher; the cipher was misattributed to him in the 19th century. It earned the name le chiffre indéchiffrable, "the indecipherable cipher", and resisted attack until Friedrich Kasiski published a general method in 1863. Charles Babbage had broken it by 1854 but did not publish.

How the Vigenère Cipher Is Broken

Everything depends on the keyword's length. If the same piece of plain text lines up with the same part of the keyword twice, it produces the same cipher text twice. Kasiski examination measures the distances between such repeats; the key length is likely a common factor of them. Once you know the length n, every nth letter was shifted by the same key letter, so each of those n columns is an ordinary Caesar cipher that frequency analysis can solve. A longer, unpredictable keyword resists this, and a random key as long as the message and used once is the one-time pad, which cannot be broken. This tool encodes and decodes with a keyword you supply; it does not search for the key.

Limits of This Tool

  • Only A–Z and a–z are enciphered. Letters of other scripts, and accented Latin letters such as é, are left unchanged, and the tool tells you how many letters it skipped.
  • The keyword must be letters only. A space, digit or accented letter in the keyword is rejected.
  • The working table shows 20 rows, however long the message.
  • Not secure. Use it for puzzles, lessons and games, not for anything private.

Which Tool Do You Need?

CipherHow the key works
CaesarOne shift for the whole message
Vigenère (this page)A repeating keyword; each key letter is one shift
BeaufortLike Vigenère, but the key letter minus the message letter, so one operation both encodes and decodes
AutokeyA short primer, then the message itself becomes the key
PortaA keyword choosing among 13 reciprocal alphabets

If you are not sure which cipher you are looking at, the planned Cipher Identifier will help narrow it down.

Frequently Asked Questions

What is a Vigenère cipher?
A polyalphabetic substitution cipher that shifts each letter by an amount set by a repeating keyword. The first message letter uses the first key letter, the second uses the second, and so on, so one plain letter can become many cipher letters.
How is the Vigenère cipher different from a Caesar cipher?
A Caesar cipher uses a single fixed shift. A Vigenère cipher uses a keyword, giving a different Caesar shift to each letter; it is effectively several Caesar ciphers interleaved, one per key letter.
What happens to spaces, numbers and punctuation?
They pass through unchanged and do not use up a key letter, so the keyword advances only on A–Z and a–z.
How do I decode a Vigenère cipher?
If you know the keyword, choose Decode, enter it and paste the cipher text. Each letter is shifted back by its key letter. Without the keyword you need cryptanalysis: Kasiski examination to find the key length, then frequency analysis on each column.
Why does my result look identical to the input?
A keyword made only of the letter A (or a single a) shifts every letter by zero. Choose a keyword with other letters.
Is the Vigenère cipher secure?
No. It looked unbreakable for about three centuries, but Kasiski published a general attack in 1863, and computers solve it in moments. It remains a good way to learn polyalphabetic ciphers.
Can it handle non-English alphabets?
Not as a cipher. The Vigenère square is the 26-letter Latin alphabet, so other scripts are passed through unenciphered and the tool reports how many letters it left alone.

Related Tools

More in Codes & Ciphers

See all Codes & Ciphers