Chris Spackman's NeoCities Page

Vigenère Cipher

The Vigenère cipher is a polyalphabetic cipher — instead of shifting every letter by the same amount (like the Caesar cipher), it uses a repeating keyword to apply a different shift to each letter position. Think of it as having multiple decoder rings and cycling through them as you encrypt each letter of your message.

The Multiple Decoder Rings Analogy

Imagine you have a collection of decoder rings, one for each letter of your keyword. The first ring is set to the shift for the first keyword letter, the second ring to the second keyword letter, and so on. As you encrypt each letter of your message, you pick up the next ring in sequence. When you run out of rings, you start over from the first one. This means two identical letters in the plaintext can become different letters in the ciphertext, making the cipher much harder to crack.

Try It

Result

Letter-by-Letter

Frequency Analysis

Notice how the ciphertext frequencies are much flatter than typical English. Because each letter position uses a different shift, the familiar peaks and valleys of frequency analysis get smeared out — this is exactly what makes polyalphabetic ciphers harder to break than simple substitution.

How It Works

Each letter of the plaintext is shifted by the corresponding letter of the keyword. If the keyword is shorter than the message, it repeats. The keyword letter tells you how far to shift: A = 0, B = 1, C = 2, and so on up to Z = 25.

The formula is: C = (P + K) mod 26, where P is the plaintext letter's position, K is the keyword letter's position, and C is the resulting ciphertext letter.

To decrypt, reverse the shift: P = (C − K) mod 26.

Why It Was Called “Le Chiffre Indéchiffrable”

For roughly 300 years, the Vigenère cipher was considered unbreakable — earning it the French nickname "the indecipherable cipher." Unlike simple substitution ciphers, it resists straightforward frequency analysis because the same plaintext letter encrypts to different ciphertext letters depending on its position. It was not until the 1860s that Charles Babbage and Friedrich Kasiski independently discovered methods to break it, by finding the keyword length first and then treating each position as a separate Caesar cipher.

Things to Try

Disclaimer: these pages are educational demos provided as-is, with no warranty of any kind. The author is not responsible for any consequences arising from their use.

Send comments and bug reports to chris@chrisspackman.com.

Version 0.1.1 — Last updated: 2026-07-02

This page is Copyright © 2025 – 2026 Chris Spackman <chris@chrisspackman.com>.
This web site developed entirely on GNU/Linux with Free / Open Source Software.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Creative Commons License