The classic textbook example
ATTACKATDAWN
LXFOPVEFRNHR
Key LEMON repeats under the message: A+L = L, T+E = X, T+M = F, and so on.
Encrypt or decrypt with a keyword using the Vigenère, Beaufort or Autokey cipher. No key? Paste the ciphertext in Decrypt mode and the solver works out the key for you.
Key solver
ATTACKATDAWN
LXFOPVEFRNHR
Key LEMON repeats under the message: A+L = L, T+E = X, T+M = F, and so on.
attack at dawn
lxfopv ef rnhr
The key only moves forward on letters, so spaces do not change the result.
attackatdawn
qnxepvytwtwp
After the key runs out, the message itself is used as the key: QUEENLY + attackatdawn.
Eznwxfizpwlp ka ioi gtiramtg wu wvfvmramei qcmsioiipse dg iyeeundyqzpo xa mevw p msio bwhx fptn alv kvilrugl gleugz rhr lpltywkcvs. Msi vpgli tgvibvzga ioi Mkotuiig kxwlvt epz grnttk xyg qckitkxwlvrdtt jmgjmg, brkkt Roeinmh Iesdivl eef Ngpiutqro Oruqhrm jjwllh yqe iv figiz px.
Cryptography is the practice of protecting information by transforming it into a form that only the intended reader can understand. For three centuries the Vigenere cipher was called the indecipherable cipher, until Charles Babbage and Friedrich Kasiski showed how to break it.
Delete the key and look at the Key solver under the tool: it recovers CIPHER from the ciphertext alone.
The Vigenère cipher encrypts text with a keyword: each letter is shifted by the matching letter of the key, which repeats along the message. With the key LEMON, the first letter is shifted by L (11), the second by E (4), the third by M (12), and so on. It is a set of Caesar ciphers used in turn, which makes it a polyalphabetic cipher.
It was described by Giovan Battista Bellaso in 1553 and later misattributed to Blaise de Vigenère. Because the same letter can be encrypted in different ways, simple frequency analysis fails, and for about three centuries it was known as le chiffre indéchiffrable, "the indecipherable cipher".
Number the letters A = 0 to Z = 25. With plaintext letter P and key letter K:
encrypt: C = (P + K) mod 26decrypt: P = (C − K) mod 26| Plaintext | A | T | T | A | C | K | A | T | D | A | W | N |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Key | L | E | M | O | N | L | E | M | O | N | L | E |
| Ciphertext | L | X | F | O | P | V | E | F | R | N | H | R |
Historically, people used a 26 × 26 table called the tabula recta: find the plaintext letter's column and the key letter's row, and read the ciphertext letter where they meet.
| Variant | Encryption | Key | Notes |
|---|---|---|---|
| Vigenère | C = (P + K) mod 26 | Repeating keyword | The classic form |
| Beaufort | C = (K − P) mod 26 | Repeating keyword | Self-reciprocal: the same operation encrypts and decrypts |
| Autokey | C = (P + K) mod 26 | Keyword, then the plaintext itself | No repeating key, so the solver below cannot crack it |
A repeating key is the weakness. If the key has n letters, every nth letter of the message was shifted by the same amount, so each of those groups is just a Caesar cipher. The solver on this page breaks it in two steps:
This is the modern version of the attack published by Friedrich Kasiski in 1863 (Charles Babbage had found a method earlier but did not publish it). It needs enough text: with fewer than about 10 letters per key letter, the guesses become unreliable, so always check the result.
Vigenère is not secure. As this page shows, it can be broken from the ciphertext alone. The only unbreakable version is the one-time pad, where the key is truly random, as long as the message and never reused.
function vigenere(text, key, decrypt = false) { const k = key.toUpperCase().replace(/[^A-Z]/g, ''); let j = 0; return text.replace(/[a-z]/gi, (c) => { const base = c <= 'Z' ? 65 : 97; const shift = k.charCodeAt(j++ % k.length) - 65; const x = c.charCodeAt(0) - base; return String.fromCharCode(base + ((x + (decrypt ? 26 - shift : shift)) % 26)); });} vigenere('attack at dawn', 'LEMON'); // "lxfopv ef rnhr"vigenere('lxfopv ef rnhr', 'LEMON', true); // "attack at dawn"def vigenere(text: str, key: str, decrypt: bool = False) -> str: k = [ord(c) - 65 for c in key.upper() if c.isalpha()] out, j = [], 0 for c in text: if c.isascii() and c.isalpha(): base = 65 if c.isupper() else 97 shift = -k[j % len(k)] if decrypt else k[j % len(k)] out.append(chr((ord(c) - base + shift) % 26 + base)) j += 1 else: out.append(c) return ''.join(out)Only the first few letters decrypt correctly
The key is slightly wrong, or the sender's key advanced on spaces and punctuation too. This tool (like most) only advances the key on letters. Remove the spaces from the ciphertext and try again if you suspect the other convention.
The solver suggests a key that is the right one repeated, such as CIPHERCIPHER
Multiples of the true key length fit too, and they decrypt the same way. The solver lists the shortest good candidate first; the shortest repeating part is the real key.
The solver's key is almost right but has a wrong letter
The text is too short for frequency analysis on every column. Read the decryption, spot the column that looks wrong, and fix that key letter by hand: the rest of the message will tell you which letter fits.
Autokey ciphertext cannot be solved
Autokey has no repeating key, so the column method does not apply. You need the keyword, or a guess of a word in the message.
Choose Decrypt and paste at least 40 letters of ciphertext. The Key solver estimates the key length with the index of coincidence, then finds each key letter with frequency analysis, and lists the most likely keys. Click a key to apply it.
Caesar shifts every letter by the same amount. Vigenère changes the shift for each letter according to a keyword, so the same plaintext letter can become different ciphertext letters.
A Vigenère variant that computes C = (K − P) mod 26 instead of (P + K). It is self-reciprocal, so the same operation and key encrypt and decrypt.
Not in this tool: the key only moves on letters, which is the most common convention. Spaces, digits and punctuation are copied unchanged.
No. It has been breakable since the 1800s, and a computer does it in milliseconds. Use it for puzzles and learning, not for real secrets.
No. Encryption, decryption and the solver all run in your browser.
Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.
Tip: press Ctrl D to bookmark dev247.