b2KIT

Vigenere Cipher Tool

Encrypt and decrypt text using the Vigenere cipher with key visualization and frequency analysis tools.

Tested tool guide Tested browser tools Checked August 16, 2026

What Vigenere Cipher Tool does, with a checked example

Each letter is shifted by a key letter (A = 0, B = 1, ... Z = 25), and the keyword repeats across the message, so the same plaintext letter can become different ciphertext letters depending on where it sits under the key. Enter plaintext plus a keyword to get ciphertext, or ciphertext plus the keyword to get plaintext back. The key visualization shows which key letter acts at each position, and the frequency analysis shows why the ciphertext's letter counts stop looking like English. The usual mistake is expecting a fixed letter-for-letter mapping like a Caesar cipher; the mapping here changes with every letter.

Worked example

A concrete input and expected output from the current implementation.

Input

Plaintext: ATTACKATDAWN, Key: LEMON (encrypt)

Expected output

LXFOPVEFRNHR

The keyword LEMON yields the repeating shifts 11, 4, 12, 14, 13. Each plaintext letter moves by its shift, wrapping modulo 26: A+11 = L, T+4 = X, T+12 = F (31 minus 26), and so on across all twelve letters. Subtracting the same shifts from LXFOPVEFRNHR returns ATTACKATDAWN.

How the result is produced

1

How encryption works

Encryption adds the key letter to the plaintext letter, A = 0 through Z = 25, wrapping modulo 26; decryption subtracts instead. The keyword repeats cyclically, so positions 1, 7, 13 and so on all use the same key letter. A plaintext letter encrypted under one key letter has no relation to the same letter under a different key letter, which is exactly what defeats simple frequency matching.

2

How frequency analysis recovers the key

Ciphertext from a Vigenere has an index of coincidence near 0.038, while English text sits near 0.066. Split the ciphertext into columns, taking every k-th letter together, and the columns approach the English value only when k is the true key length. Testing candidate lengths this way, and checking Kasiski's repeated-chunk spacings, recovers the key length; each column then becomes a single Caesar shift, solvable by letter frequency.

Good uses

  • Check hand-computed homework or textbook exercises: encrypt a message with a chosen keyword, compare the result with your own calculation, then decrypt it back with the same keyword to confirm the round trip.
  • See polyalphabetic behavior for yourself: encrypt a plaintext that repeats letters and watch the same letters land on different ciphertext letters, and confirm with the frequency view that the ciphertext letter counts flatten out.
  • Attack a Vigenere-encrypted ciphertext from a puzzle or CTF: estimate the key length with the frequency analysis, test candidate keywords, and read off the recovered plaintext when a guess produces recognizable language.

Limits and checks

  • A = 0 is the usual convention, but some tools and textbooks count A = 1, shifting every letter by one. Ciphertexts from the two conventions are incompatible, so compare outputs only between tools that share a convention.
  • Handling of non-letters varies. The common convention passes spaces, digits and punctuation through unchanged and does not advance the key over them; others advance the key anyway. The same input can produce different ciphertexts in different tools, so state the convention when sharing results.
  • There is no integrity check: decrypting with the wrong key always succeeds mechanically and yields plausible-looking garbage, so the tool cannot tell you that your key was wrong. Judge correctness by whether the output reads like language, and note that frequency-based key-length estimates get unreliable on short messages.

Common questions

Is the Vigenere cipher secure?

No. The repeating key leaves structure behind: Kasiski examination and index-of-coincidence analysis recover the key length from enough ciphertext, and known plaintext recovers the key directly. A random key as long as the message, used once - a one-time pad - is genuinely unbreakable, but that is a different scheme. For practical confidentiality use a modern cipher such as AES.

Why does the same plaintext letter encrypt differently at different positions?

The shift changes at every position because the key letter changes. With key LEMON, an A at position 1 shifts by L (11) to L, while an A at position 4 shifts by O (14) to O. The same plaintext letter scatters across several ciphertext letters, and identical ciphertext letters can equally decrypt to different plaintext letters.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools