How do I encode text with a Vigenere cipher?
Enter a keyword and your text, and this tool shifts each letter by the matching letter of the keyword, which repeats across the message. Decoding reverses the shift. Case is preserved, and numbers, spaces and punctuation are left unchanged and do not advance the keyword. It is a classic cipher for learning, not real security.
How the Vigenere cipher works
The Vigenere cipher scrambles a message using a keyword. You line the keyword up under your text, repeating it as many times as needed, and each keyword letter tells you how far to shift the letter above it. A stands for a shift of 0, B for 1, and so on up to Z for 25. Because the shift changes from letter to letter, the same plaintext letter can turn into different letters in different places, which is what makes it a polyalphabetic cipher and much harder to read than a single fixed shift.
Only the 26 letters are shifted. Spaces, numbers and punctuation are left exactly as they are, and they do not move the keyword along, so the keyword stays lined up with the letters of your message. Each letter also keeps its upper or lower case, so the shape of the text survives.
A worked example
Take the plaintext ATTACKATDAWN and the keyword LEMON. Repeat the keyword to get LEMONLEMONLE, then add each pair. A plus L is L, T plus E is X, T plus M is F, and so on. The result is LXFOPVEFRNHR. To read it back you set the same keyword, switch to decode, and each shift is subtracted instead of added, returning the original text.
A short history
The method is named after Blaise de Vigenere, a French diplomat of the 1500s, although the core idea had appeared earlier in the work of Giovan Battista Bellaso. For a long time it was called the indecipherable cipher, because the changing shift hides the letter-frequency patterns that give simpler ciphers away. That reputation lasted until the 1800s, when Charles Babbage and later Friedrich Kasiski showed how the repeating keyword leaves a pattern of its own. Spot how often the keyword repeats and you can split the message into separate Caesar ciphers and crack each one.
A learning tool, not real security
Say it plainly: the Vigenere cipher is not safe for anything that must stay private. Its weakness is the repeating keyword, and modern computers break it in moments. It is a wonderful way to understand how ciphers improved on the simple Caesar cipher and why key reuse is dangerous, but it belongs in classrooms, puzzles and escape rooms, not around real secrets. For those, use modern encryption with keys far too large to guess. Because this tool runs entirely in your browser, you can paste in as much text as you like to experiment, and nothing is uploaded or stored anywhere.
How we work it out
For each letter, the tool adds the value of the current keyword letter (A is 0 to Z is 25), wrapping Z back to A. The keyword uses only its letters, cycled, and only advances on letters in the text. Decoding subtracts instead of adding.
Frequently asked questions
What is a Vigenere cipher?
It is a classic cipher that shifts each letter of your text by a different amount, set by a repeating keyword. Where a Caesar cipher uses one fixed shift for the whole message, Vigenere cycles through the keyword letter by letter, so the same plaintext letter can encode to different letters. That is why it is called polyalphabetic.
How does the keyword work?
The keyword is repeated across your text, one keyword letter per text letter. Each keyword letter gives a shift, where A means shift by 0, B by 1, up to Z by 25. Only the letters of the keyword are used, so any spaces or punctuation in it are ignored, and the keyword only advances on letters in your text.
What happens to numbers, spaces and punctuation?
They are passed through unchanged, and crucially they do not advance the keyword. This keeps the alignment between the keyword and the letters of your message intact, so decoding with the same keyword returns exactly the original text. The upper or lower case of each letter is also preserved.
Is the Vigenere cipher secure?
No. For centuries it was thought unbreakable, which earned it the nickname the indecipherable cipher, but it was broken in the 1800s using the repeating pattern of the keyword. Treat it as a puzzle or a way to learn how ciphers work, never as real protection. Use proper encryption for anything that must stay secret.
How is it different from a Caesar cipher?
A Caesar cipher shifts every letter by the same fixed amount, so it has only 25 useful keys and falls instantly. Vigenere varies the shift using a keyword, which hides the letter-frequency pattern that gives a Caesar cipher away. It is stronger, but still weak by modern standards.