Vigenère Cipher Encoder and Decoder
Type a keyword and your text to encrypt or decrypt a Vigenère cipher. See the key lined up under every letter, and the full Vigenère table if you want to check it by hand.
How the Vigenère cipher works
A Vigenère cipher is a set of Caesar shifts that take turns. Each letter of the keyword stands for a shift: A is 0, B is 1, and so on up to Z at 25. Write the keyword under your message, over and over, and shift each letter by the key letter under it. The same plain letter can come out differently depending on where it falls, which is what made the cipher so much harder to break than a Caesar cipher.
This tool follows the usual rules. Only the letters A to Z are changed, and capitals stay capitals. Spaces, digits and punctuation are copied across as they are, and they don’t use up a key letter. Anything in the keyword that isn’t a letter is ignored, so “lemon 42” works the same as LEMON. Decrypting is the same job in reverse: each letter shifts back by its key letter. You need the keyword to do that. Without it, see the last section below.
A worked example
The textbook example encrypts ATTACK AT DAWN with the key LEMON. Line the key up under the letters and add the two positions, wrapping past Z back to A:
| Plain text | A | T | T | A | C | K | A | T | D | A | W | N |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Key, repeated | L | E | M | O | N | L | E | M | O | N | L | E |
| Shift | 11 | 4 | 12 | 14 | 13 | 11 | 4 | 12 | 14 | 13 | 11 | 4 |
| Cipher text | L | X | F | O | P | V | E | F | R | N | H | R |
The first T sits under E (a shift of 4) and becomes X. The second T sits under M (a shift of 12): 19 plus 12 is 31, which wraps to 5, the letter F. So one word has the same letter turning into two different ones. The result is LXFOPV EF RNHR. Paste that into the box with the key LEMON and the Decrypted panel shows ATTACK AT DAWN again.
Who invented the Vigenère cipher?
The idea of switching alphabets with an agreed keyword appears in a 1553 booklet by Giovan Battista Bellaso. Blaise de Vigenère wrote about ciphers in a treatise published in 1586, and his name got attached to this one. For about three hundred years it had a reputation as the cipher nobody could crack.
The first published method for breaking it came from Friedrich Kasiski, a Prussian army officer, in his 1863 book. Charles Babbage had worked out a similar attack earlier, but he never published it.
Can you decode a Vigenère cipher without the key?
Often, yes, if the message is long enough. Kasiski’s trick is to look for chunks of letters that repeat in the cipher text. When the same word lines up with the same part of the key twice, it encrypts the same way, and the gap between the two copies is a multiple of the key length. Once you know the key is, say, 5 letters long, every 5th letter was shifted by the same amount. Each of those groups is a plain Caesar cipher, and you can solve it by checking which shift gives English-looking letter counts. This page doesn’t try to guess keys for you. Short messages rarely have enough repeats for the guess to be reliable.
A Vigenère cipher is fine for puzzles, escape rooms and classroom exercises. It won’t protect anything real. To lock text with a password, use Encrypt Text, which uses AES. For a tour of the other classic ciphers, read types of ciphers.