Cabinet Noir>Learn / Vigènere cipher

Not sure which cipher? Identify it
Each letter of the message is shifted by the matching letter of a repeating key.
Typepolyalphabetic substitution cipher
Breaking ithard to break by hand
Era16th century
NameDescribed by Giovan Battista Bellaso in 1553, later misattributed to Blaise de Vigenère.
Modesencrypt · decrypt · cryptoanalysis

Learn

Vigènere cipher

How the Vigenère cipher works

The idea in one sentence

Vigenère shifts every letter of the Plaintext by a different amount: the first letter by the first Key letter, the second by the second key letter, and so on. When the key runs out, it starts again from its first letter. This is why it is called a Polyalphabetic cipher: the same plaintext letter can become different Ciphertext letters, which defeats a plain Frequency analysis attack.

The recipe

  1. Write your message and keep only the letters (the tool drops spaces and punctuation the same way).

  2. Write the key under the message, letter by letter, repeating it until both lines have the same length.

  3. Shift each message letter forward through the Alphabet by as many positions as the key letter says: A counts as 0, B as 1, … Z as

    1. That number is the Shift.

  4. Read off the letters you landed on — that is the ciphertext.

A worked example

Step 1 of 12
Plaintext letter
Key letter
Shift
Result
A
L
11
L

Read the first row: the plaintext letter A shifted by the key letter L (position 11) lands on L. The key LEMON then repeats, so the second letter is shifted by E, the third by M, and after the fifth letter the key starts over — that repeat is both the strength and the weakness of the cipher.

The formula

Numbering A=0 … Z=25, encryption adds the two positions and wraps around the alphabet:

cipher = (plain + key) mod 26
plain  = (cipher - key + 26) mod 26

The table of all 26 possible shift alphabets is the famous tabula recta; you never need the whole table — one column per key letter is enough.

One alphabet or another

The tool defaults to the English alphabet, but the cipher works with any ordered set of letters: paste your own into the Alphabet field — a reshuffled English alphabet, or another language. The arithmetic stays the same; only the alphabet length changes (the formula then wraps at that length instead of 26).

Try it in the tool

Step-by-step guides

Encrypt your first message

  1. Type your message into the message input.

  2. Pick any word as the secret and enter it in the Key field — longer keys are harder to break.

  3. Check the mode: the swap button the swap button toggles between encrypt and decrypt. The header shows the current mode.

  4. Read the encrypted result in the output field. Only letters are encrypted; spaces and punctuation are dropped.

Decrypt a message you received

  1. Paste the cryptogram into the message input.

  2. Enter the key the sender used in the Key field — you need the exact same key that encrypted the message.

  3. Press the swap button the swap button to switch to decrypt mode.

  4. Read the original message in the output field.

Break a message without the key

  1. Check the the "Unknown key" checkbox box next to the key field. The cracker opens below.

  2. Step 1 — the key length: repeated sequences in the text are highlighted; pick the most confident card from the key length cards. Wrong guess? Go back and try another.

  3. Step 2 — the key letters: for each slice in the slice tabs, rotate the chart with the chart arrows until the match score is highest. The letters collect in the key strip. Stuck? A guess in the crib input can reveal several letters at once.

  4. Step 3 — check the assembled key: fix any letter directly in the key strip, then press the "Use this key" button.

  5. The tool decrypts the message with your key.

Breaking the Vigenère cipher

The repeating Key is what makes the cipher breakable. This page explains the attack; every step has a matching step in the tool's guided cracker, so you can follow along while reading.

Try it in the tool

The flaw: the key repeats

Encryption shifts letter i of the plaintext by key letter i — but the key is short, so letter i+5 (with a 5-letter key) is shifted by the same key letter again. Whenever the plaintext contains the same letter at two positions a multiple of the key length apart, the Ciphertext shows the same letter there too. Long texts repeat common letter groups (the, and, tion…), and those repeats leak the Key length.

Step 1 — find the key length

Two independent signals, both shown on the cracker's key length cards:

  • Repeated sequences — the Kasiski examination: find groups of letters that appear several times, measure the distances between them, and look for lengths that divide many of those distances. If the gaps are 12 and 18, the key length divides both — 6 is a better guess than 36.

  • The Index of coincidence — for a candidate length N, split the text into N slices (every Nth letter) and measure how English-like each slice looks. English scores about 0.067, random letters about 0.038. When N is the true key length, every slice was shifted by a single letter and still looks like English.

Step 2 — each slice is a Caesar cipher

Knowing the key length, every slice is encrypted with one fixed key letter — it is now just a Caesar cipher of the kind any schoolchild breaks. The tool's chart lays a slice's letter counts against the English frequency table: rotate until the tall bars sit over the tall reference bars, and the shown letter is that slice's key letter. One rotation per slice, and the whole key is out — watch the live preview turn into readable text as you go.

A shortcut — cribs

Sometimes you can guess a word that must appear in the plaintext (a greeting, a name, "attack"). Place the Crib at a position and subtract: each ciphertext letter minus the guessed plaintext letter is a key letter. A correct guess reveals several key letters at once; a wrong one is rejected because it contradicts itself.

The limits

  • Short texts lie. With few letters per slice, frequency analysis becomes guesswork — that is why the cracker warns you and why a crib helps.

  • Long keys hurt. A key as long as the text, used once, is the Substitution-free ideal: the one-time pad, the only cipher proven unbreakable. Vigenère with a one-time key is a one-time pad.

  • Everything else is bookkeeping. Once the key length is known, the rest is mechanical — which is exactly what the guided cracker automates the arithmetic for, while you make the decisions.

Glossary

Plaintext — The original readable message before encryption.
Ciphertext — The scrambled message produced by encryption.
Key — The secret that controls how the text is scrambled.
Alphabet — The set of letters the cipher works with.
Key length — How many letters the key has before it starts repeating.
Slice — Every Nth letter of the text (N = key length). All letters of one slice are shifted by the same key letter.
Frequency analysis — Studying how often letters appear; comparing the counts with the language reveals the plaintext.
Index of coincidence — A number (about 0.067 for English) showing how likely two random letters of a text are equal.
Kasiski examination — Finding the key length from the distances between repeated sequences in the ciphertext.
Crib — A word you guess is in the plaintext; comparing it with the ciphertext reveals key letters.