Home › Developer Tools › Vigenère Cipher

Vigenère Cipher

Encrypt or decrypt text with the Vigenère cipher, its Autokey and Beaufort variants, and trace every letter on the tabula recta. No key? The built-in solver estimates it from the ciphertext, all in your browser.

Key used: LEMON (5 letters)

Key stream alignment

Each letter is shifted by the key letter under it (A = 0, B = 1 … Z = 25). Click a column to see it on the tabula recta.

Show tabula recta (Vigenère square)

Row = key letter, column = plaintext letter, cell = ciphertext letter.

No key? Crack the cipher

For standard Vigenère text in English, paste at least ~100 letters of ciphertext above. The tool estimates the key length (Kasiski examination + index of coincidence) and each key letter (frequency analysis).

Advertisement

How to use the Vigenère Cipher

  1. Choose Encrypt or Decrypt and the cipher variant (standard Vigenère is the default).
  2. Enter the key, for example LEMON. Only letters count; everything else in the key is ignored.
  3. Type or paste your text. The result updates instantly; press Encrypt text or Decrypt text to confirm, then Copy result.
  4. Study the alignment: click any letter column to see the matching row and column on the tabula recta.
  5. No key? Paste the ciphertext, switch to Decrypt and press Analyze ciphertext & find key, then Use this key on the best guess.

The Vigenère formula

Number the letters A = 0 to Z = 25. For the i-th letter of the message P and the key K of length m:

  • Encrypt: Ci = (Pi + Ki mod m) mod 26
  • Decrypt: Pi = (Ci − Ki mod m) mod 26
  • Beaufort: Ci = (Ki mod m − Pi) mod 26, the same in both directions

Worked example: ATTACK AT DAWN with key LEMON

PlaintextATTACKATDAWN
KeyLEMONLEMONLE
Shift114121413114121413114
CiphertextLXFOPVEFRNHR

Notice that the two A's at positions 1 and 4 become different letters (L and O). That is what makes Vigenère polyalphabetic and hides simple letter frequencies, unlike the Caesar cipher, which uses one shift for every letter.

How the key cracker works

  1. Index of coincidence (IoC): the probability that two random letters of a text are the same. English text scores about 0.066; uniformly random letters score 1/26 ≈ 0.038. When the ciphertext is split into columns using the correct key length, every column is a Caesar shift of English, so the average column IoC jumps up to the English value.
  2. Kasiski examination: repeated three-letter sequences in the ciphertext are often the same plaintext encrypted with the same part of the key. Their distances tend to be multiples of the key length, so the most common factors are reported as a second opinion.
  3. Chi-squared test: for each column the tool tries all 26 shifts and keeps the one whose letter counts are closest to normal English frequencies (E 12.7%, T 9.1%, A 8.2%, O 7.5% …). The 26 shifts give the key letters.

Short ciphertexts, non-English plaintext or keys almost as long as the message make statistics unreliable. A key as long as the message that is truly random and never reused is a one-time pad, which cannot be broken at all.

Frequently asked questions

How does the Vigenère cipher work?

Each letter of the message is shifted by the value of the key letter beneath it (A = 0, B = 1 … Z = 25), and the key repeats for the whole message. With key LEMON, the first letter moves 11 places, the second 4, the third 12 and so on, so ATTACKATDAWN becomes LXFOPVEFRNHR.

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

Paste the ciphertext, select Decrypt and press Analyze ciphertext & find key. The tool finds the most likely key length with the index of coincidence and Kasiski examination, then solves each key letter as a Caesar shift with chi-squared frequency analysis. It works best on 100+ letters of English text with a key that is much shorter than the message.

Do spaces and punctuation use up key letters?

No. Like most textbook and puzzle implementations, only letters A–Z are encrypted and advance the key; spaces, digits, punctuation and accented letters pass through unchanged. Choose Letters only or Groups of 5 if you want to hide word boundaries.

What is the Autokey cipher?

Autokey, also described by Vigenère, starts with the keyword and then continues the key stream with the plaintext itself, so the key never repeats. With key QUEENLY, ATTACKATDAWN encrypts to QNXEPVYTWTWP. It defeats the Kasiski test, which is why the solver here targets the standard repeating-key cipher.

What is the Beaufort cipher?

Beaufort uses the same tabula recta but computes cipher = key − plaintext (mod 26) instead of adding. It is reciprocal: encrypting twice with the same key gives back the original, so encrypt and decrypt are the same operation.

Is the Vigenère cipher secure?

No. It was called le chiffre indéchiffrable for about 300 years, but it has been routinely broken since the 1860s. Use it for puzzles, escape rooms, geocaches and learning. For real secrets, use modern encryption such as AES.

Is my text sent anywhere?

No. Encryption, decryption and cracking run entirely in JavaScript in your browser; nothing is uploaded or logged.

Related tools