Skip to content
Toolcroft

Vigenère Cipher - Encode & Decode Online

Password & Security

Encode or decode text with the Vigenère cipher. Enter your text and a keyword - each letter is shifted by the corresponding letter of the repeating keyword.

Letter alignment

A–Z map to shifts 0–25 (L is 11). Encode adds each key shift; Decode subtracts it. Spaces and punctuation pass through unchanged and do not consume key positions. A middle dot marks whitespace or a key position that is not used.

PlainAttack·at·dawn
KeyLEMONL·EM·ONLE
CipherLxfopv·ef·rnhr

How to use this tool

  1. Enter or paste your message in the Text box.
  2. Type your keyword (letters only; the tool strips non-alpha characters).
  3. Select Encode to encrypt or Decode to decrypt.
  4. The result appears instantly. Click Copy to copy it.

What is the Vigenère cipher?

The Vigenère cipher is a classical polyalphabetic substitution cipher invented in the 16th century. Unlike the Caesar cipher which uses a single fixed shift, Vigenère uses a keyword: each letter of the keyword determines the shift for the corresponding letter of the message. The keyword repeats as needed. For example, with keyword LEMON and message ATTACKATDAWN, the shifts are L(11), E(4), M(12), O(14), N(13), L(11), E(4), M(12), O(14), N(13), L(11), repeated, producing LXFOPVEFRNHR.

How encoding works

For each alphabetic character at position i, find the key character k = keyword[i mod key-length]. The encoded character is (plaintext + k) mod 26. Decoding reverses this: (ciphertext − k + 26) mod 26. Non-alphabetic characters (spaces, digits, punctuation) are passed through unchanged, and the key index only advances on alphabetic characters.

Is the Vigenère cipher secure?

No, not by modern standards. The Vigenère cipher was considered unbreakable for centuries until Charles Babbage and Friedrich Kasiski independently showed that repeated keyword patterns leave statistical fingerprints. The Kasiski test and index-of-coincidence analysis can break it given sufficient ciphertext. Use it for puzzles, educational purposes, and historical study. Not for protecting real secrets.

Kasiski examination

The Kasiski test exploits the fact that when a keyword repeats, the same plaintext letters encrypted with the same key positions will produce repeated ciphertext substrings. By finding repeated substrings in the ciphertext and measuring the distances between them, an analyst can deduce the key length (it will divide most of the distances). Once the key length L is known, every Lth character was encrypted with the same Caesar shift, and each of the L groups can be broken by frequency analysis independently.

Index of coincidence

Friedman’s index of coincidence (IC) is the probability that two randomly selected characters from a text are the same. English plaintext has IC ≈ 0.065; uniformly random text has IC ≈ 0.038. A Vigenère ciphertext with a short key has an IC closer to English (0.065) than to random, while a long key pushes it toward 0.038. By testing different assumed key lengths and measuring the IC of each subgroup, analysts can identify the true key length statistically.

Historical context

The Vigenère cipher was described by Giovan Battista Bellaso in 1553 but was misattributed to Blaise de Vigenère in the 19th century (who had described a different, stronger autokey cipher). For nearly 300 years it was known as le chiffre indéchiffrable - the unbreakable cipher. Charles Babbage cracked it around 1854 but kept his method secret for strategic reasons; Friedrich Kasiski independently published the attack in 1863.

Frequently asked questions

What is the Vigenère cipher?

The Vigenère cipher is a polyalphabetic substitution cipher that uses a keyword to determine the shift for each letter. The keyword repeats to match the length of the message, and each letter of the message is shifted by the corresponding letter of the keyword. Unlike the Caesar cipher (which uses a single fixed shift), this variation makes frequency analysis much harder.

How do I decode a Vigenère-encoded message?

You need to know the keyword. Enter the encoded (ciphertext) in the text area, switch to Decode mode, type the keyword, and the original plaintext will appear instantly.

Does the keyword need to be the same length as the message?

No. The keyword repeats automatically. For example, a 4-letter keyword used with a 12-letter message will cycle through the keyword 3 times.

Are numbers and punctuation shifted?

No. Only alphabetic characters (A–Z, a–z) are shifted. Numbers, spaces, and punctuation pass through unchanged, and the keyword index only advances on alphabetic characters.

Browse all password & security