Vigenere Cipher
Type a message and a keyword to encode it, or switch to decode to read a message you were given. Case and punctuation are kept.
Worked examples
Classic example
ATTACKATDAWN
LXFOPVEFRNHR
The keyword LEMON repeats along the message.
Case and punctuation kept
Attack at dawn!
Lxfopv ef rnhr!
Spaces and the exclamation mark do not use up keyword letters.
About Vigenere Cipher
The Vigenere cipher improves on a simple shift by changing the shift as it goes. A keyword is repeated along the message, and each letter of the message is moved along the alphabet by the value of the matching keyword letter, where A means no shift, B means one place, and so on up to Z for 25. With the keyword LEMON the first letter is moved 11 places, the second 4, the third 12, and the pattern then repeats.
Because one letter can encode to different letters depending on its position, counting how often letters appear no longer gives the message away at once, which is why the cipher was thought unbreakable for about three centuries. Today it is a classic puzzle and teaching tool. Type a message and a keyword, choose encode or decode, and read the result. Case, spaces, digits and punctuation are kept where they are, and the keyword only moves on when a letter is coded.
How to use Vigenere Cipher
- Type or paste your message into the box.
- Enter the keyword. Only its letters are used.
- Choose encode or decode.
- Copy the result. To check it, switch direction and use the result as the input.
Common uses
- Solving or setting a puzzle for an escape room or a treasure hunt
- Learning how polyalphabetic ciphers work
- Checking a worked example from a textbook or a lesson
- Sending a playful coded message to a friend who knows the keyword
Frequently asked questions
What does the classic example give?
The message ATTACKATDAWN with the keyword LEMON encodes to LXFOPVEFRNHR. Enter the encoded text with the same keyword and choose decode to get it back.
Why are my spaces and punctuation unchanged?
Only the letters A to Z are shifted. Spaces, digits and punctuation stay in place and do not use up a keyword letter, so the message keeps its shape.
What happens to accented letters?
They are left as typed, because the cipher only covers the 26 letters of the basic alphabet.
Is the Vigenere cipher still a good way to protect a message?
No. It can be broken by analysing the repeated pattern of the keyword, and computers do it quickly. Use it for puzzles, not for anything confidential.