Vigenère Cipher Decoder
: Encode and decode the Vigenère cipher with a keyword, Beaufort and Autokey too, or crack a message whose key is unknown: every key length tried, the best key found and the text decodedOptions
Vigenère Cipher Decoder
Encode a message with the Vigenère cipher, decode one when you know the keyword, or crack it when you do not: the page tries every key length, finds the most likely key and decodes the text with it. The Beaufort and Autokey variants are here too. Use it as a Vigenère cipher decoder for puzzles, escape rooms, geocaches, CTFs and homework; it runs in your browser.
How to encode and decode a Vigenère cipher
- Type or paste into
Text, or load a.txtfile. TheExamplesgive a message, a cipher text made with the key LEMON and a longer cipher text to crack. - Pick the
Direction:Encodeencrypts with the key,Decodedecrypts with a key you know, andCrack (unknown key)works the key out from the text. - Type the
Key, a word such as LEMON. Only its letters A to Z count; spaces and digits in it are skipped. - Choose the
Cipher:Vigenère(the usual one),BeaufortorAutokey. Read the result with the plain text, key and cipher letters lined up under it, and the rows of the Vigenère square your key uses.Swapturns the result into the input and flips Encode and Decode. - Cracking: set
Longest key to try(20 by default, up to 60). The best guess is shown in full, and a table gives the best key for every length, with its index of coincidence and the start of its text.
Example
The key LEMON repeats under the message (LEMONLEMONLE), and each letter moves on by its key letter: A + L = L, T + E = X. Decoding with LEMON gives back: Attack at dawn!
Attack at dawn!Lxfopv ef rnhr!Details
- The Vigenère cipher shifts each letter of the message by a different amount, taken from a keyword: A shifts by 0, B by 1, and so on to Z by 25. The keyword is written again and again under the message, so with the key LEMON, ATTACKATDAWN becomes LXFOPVEFRNHR. It is a Caesar cipher whose shift changes letter by letter. Giovan Battista Bellaso described it in 1553; it was later named after Blaise de Vigenère, and was long called "le chiffre indéchiffrable", the unbreakable cipher.
- The Vigenère square, or tabula recta, is a table of 26 alphabets, each shifted one more place than the last. To encode by hand, find the plain letter along the top and the key letter down the side: the cipher letter is where they meet. The page shows the rows your key uses.
- Decoding a Vigenère cipher with the key subtracts the key letters instead of adding them. Upper and lower case are kept unless you change them, and spaces, digits, punctuation and letters outside A to Z are kept as typed and do not use up a key letter, so
Attack at dawn!becomesLxfopv ef rnhr!. Remove spaces, or write groups of five as classic cipher texts do: LXFOP VEFRN HR. - How to decode a Vigenère cipher without the key. If the key has n letters, every n-th letter was shifted by the same amount, so the text splits into n columns that are each a Caesar cipher. Crack tries each key length from 1 up to
Longest key to try, solves every column by how closely its letter counts match English, and then checks each key letter against the common English words it gives. Keys are ranked by common English words in the first 20,000 characters, then by letter fit. The third example cracks to the key SECRET. - The index of coincidence (the IoC column) is the chance that two letters picked from the same column match: about 0.066 for English and 0.038 for random letters. The right key length, and its multiples, score near English; this is Friedman's test, and the repeated groups Kasiski looked for come from the same pattern. A key that is the same word twice (LEMONLEMON) is folded to the word.
- Beaufort turns the sum round: cipher letter = key letter − plain letter, so the same step encodes and decodes; ATTACKATDAWN with LEMON gives LLTOLBETLNPR. Autokey uses the key once and then the message itself as the key, so nothing repeats: with the key QUEENLY it gives QNXEPVYTWTWP. Nothing you type leaves the page.
Limits
- Letters A to Z only. Accented letters and other alphabets are kept as typed, not enciphered; the notes say how many.
- Cracking needs text: roughly 15 or more letters for each key letter. A short message with a long key cannot be cracked reliably by anyone; the page says when it is not sure.
- The cracker knows English. A Vigenère cipher of another language still gets a key per length, but the ranking may be wrong; read the rows.
- Crack covers Vigenère and Beaufort. An Autokey text has no repeating key, so decode it with a key you suspect.
FAQ
How do I decode a Vigenère cipher without the key?
Choose Crack (unknown key) and paste the text. Each key length is tried, the key letters are found from English letter frequencies and common words, and the best key's text is shown in full. The longer the text, the surer the result.
How does the Vigenère cipher work?
Write the key under the message, repeating it, and shift each letter by its key letter (A = 0, B = 1 … Z = 25). With the key LEMON, ATTACKATDAWN becomes LXFOPVEFRNHR.
What is the difference between the Caesar and Vigenère ciphers?
The Caesar cipher shifts every letter by the same amount. Vigenère uses a keyword, so the shift changes from letter to letter, which hides the letter frequencies that give a Caesar cipher away. A one-letter Vigenère key is a Caesar cipher.
Is the Vigenère cipher secure?
No. Charles Babbage and Friedrich Kasiski broke it in the 19th century, and this page cracks a few lines of English in a moment. Use it for puzzles and teaching; protect real data with a modern cipher such as AES.
Does the key skip spaces and punctuation?
Yes. The key moves on one letter for each letter A to Z of the message only, the usual convention; spaces, digits and punctuation pass through unchanged.
Runs entirely in your browser. Nothing is uploaded.