The Vigenere cipher is a repeating-key polyalphabetic substitution that maps each letter of a message to a new letter by adding the shift value of the current key letter, wrapping around at 26, with the same key applied in reverse for decryption. Every ASCII letter A through Z is treated as a number from 0 to 25, every lowercase a through z is treated the same way, and the key is a short word of A–Z letters that repeats to cover the whole message. Encryption is the formula (message letter + key shift) mod 26; decryption is (message letter − key shift + 26) mod 26. The result is a sequence of Caesar shifts picked by the key, which is why a Vigenere with a one-letter key is just a Caesar cipher with a different name. Because the key is short and repeats, the cipher is a staple of cryptography classes and puzzle hunts, but the same property is exactly what makes it unsuitable for protecting real secrets.
For readers who already hold the key and want the result now, the Vigenere Cipher Decoder runs the same formula in the browser, with no upload and no account. The rest of this article walks through the arithmetic, the steps inside the tool, a worked example, and the conventions the tool locks in so the output matches what other participants expect.

How the Vigenere Cipher Transforms Letters
Vigenere is best understood as a sequence of Caesar shifts chosen by the key. A single Caesar shift moves every letter by a fixed amount; a Vigenere key picks a different shift for each position in the key, and then cycles through those shifts as the message continues.
The alphabet is numbered so that A is 0, B is 1, C is 2, and so on through Z at 25. The key follows the same numbering, so the key word LEMON reads as 11, 4, 12, 14, 13. For each ASCII letter in the message, the tool takes the numeric value of that letter, adds (for encryption) or subtracts (for decryption) the numeric value of the current key letter, takes the result modulo 26, and maps it back to a letter. If the key runs out before the message does, it starts over from the first letter.
| Mode | Formula per letter | Key advancement |
|---|---|---|
| Encrypt | (message + key shift) mod 26 | One step per ASCII letter |
| Decrypt | (message − key shift + 26) mod 26 | One step per ASCII letter |
| Skip | Character copied unchanged | No step consumed |
Source letter case is preserved: an uppercase input letter always produces an uppercase output letter of the same form, and a lowercase input letter always produces a lowercase output letter. The key is normalized internally, so LEMON, lemon, and Lemon are all the same key for the tool's purposes.
Encrypt and Decrypt a Message in Your Browser
Once the key is in hand, the actual transformation takes a few clicks. The tool keeps the input box, the key box, the mode selector, and the labeled result on one screen so it is easy to verify which key was used for which output.
- Paste plaintext into the text box to encrypt, or paste ciphertext into the same box to decrypt. The accepted size is up to 500,000 UTF-16 code units, which is the same length that JavaScript reports for the string.
- Type the key using ASCII letters A through Z only, with no spaces, digits, punctuation, or accents. Mixed case is fine; the key may be at most 256 letters long, and an empty or invalid key is rejected without producing any partial output.
- Choose Encrypt or Decrypt depending on which direction you need. Encrypt treats the box as plaintext; Decrypt treats the box as ciphertext.
- Run the transformation and read the labeled result. Use the Copy button to copy either the ciphertext or the plaintext directly to the clipboard without retyping.
- Record the exact key alongside the message. The same key in the opposite direction is the only reliable way for a partner to recover the original text, and the original case of the key is irrelevant to the tool even if a partner's program is case-sensitive.
Editing the text, the key, or the mode immediately clears the previous result and any error message, so an old ciphertext cannot linger next to a new key. Clear removes the text, key, output, and error together. If the input crosses the 500,000 code-unit limit, the tool rejects the whole input with a clear message rather than silently truncating it.
Worked Example: ATTACKATDAWN with Key LEMON
The pair ATTACKATDAWN with key LEMON is a standard textbook case, and the same pair is one of the golden tests inside the tool. Working it out by hand shows exactly what the tool does, which is a quick way to gain confidence before relying on it for a puzzle.
Number the letters: A=0, T=19, T=19, A=0, C=2, K=10, A=0, T=19, D=3, A=0, W=22, N=13. Number the key: L=11, E=4, M=12, O=14, N=13, and repeat it so the alignment is L-E-M-O-N-L-E-M-O-N-L-E. Add each pair modulo 26:
- A (0) + L (11) = 11 → L
- T (19) + E (4) = 23 → X
- T (19) + M (12) = 31 mod 26 = 5 → F
- A (0) + O (14) = 14 → O
- C (2) + N (13) = 15 → P
- K (10) + L (11) = 21 → V
- A (0) + E (4) = 4 → E
- T (19) + M (12) = 31 mod 26 = 5 → F
- D (3) + O (14) = 17 → R
- A (0) + N (13) = 13 → N
- W (22) + L (11) = 33 mod 26 = 7 → H
- N (13) + E (4) = 17 → R
The ciphertext is LXFOPVEFRNHR. Pasting that string into the tool with the same key LEMON and choosing Decrypt reverses the arithmetic: (cipher − shift + 26) mod 26 for every letter, the key stepping once per ASCII letter. The recovered text is ATTACKATDAWN, which confirms that the two operations are exact inverses. Any pair of plaintext and key that round-trips through both modes in the Vigenere Cipher Decoder will reproduce the original byte for byte, because the validation, alignment, and case handling are the same in both directions.
How Nonletters Affect the Key Index
One of the easiest ways to get a wrong answer from a hand-rolled Vigenere is to disagree with the recipient about whether spaces and punctuation advance the key. The tool picks one rule and locks it in: only ASCII letters A–Z and a–z consume a key position. Every other code unit is copied through unchanged and the next ASCII letter uses the next shift.
Under that rule, the key sits beneath letters the same way a strip of tape sits beneath a row of tiles. The tiles are the letters; the gaps are the spaces, digits, punctuation, line breaks, accented characters, emoji, and CJK code points. The tape keeps moving only where there is a tile. A key of LEMON applied to A!B?C uses L against A, E against B, and M against C; the exclamation mark and the question mark do not consume a position. This convention is stated in the tool and verified by tests, so the same input, key, and mode always produce the same output.
A single supplementary emoji is a useful edge case. The emoji occupies two UTF-16 code units but is not an ASCII letter, so both code units are copied through unchanged and the key index does not advance. That detail matters for the 500,000-code-unit limit: a long message full of emoji is rejected sooner than a message with the same number of visible characters but no emoji, and that is the predictable behavior the tool advertises.
Input Limits, Rejections, and What to Do
The tool has two hard limits and a small set of validation rules that produce explicit errors instead of partial output. Knowing them up front prevents surprises during a long conversion.
- Text length: 500,000 UTF-16 code units. The counter matches JavaScript's string length, so it counts each BMP code unit once and each supplementary code point twice. Text at the limit is transformed in full; text above it is rejected as a whole.
- Key length: 256 ASCII letters. A longer key is invalid and produces no result. An empty key is invalid for the same reason.
- Key content: A–Z or a–z only. Spaces, digits, punctuation, accents, and symbols are not allowed inside the key, even though they are allowed inside the message.
- Edit behavior: Changing the text, the key, or the mode clears the previous output and any error message, so a stale ciphertext cannot be mistaken for a fresh result.
For readers who want a fair comparison with a single-shift cipher, the Caesar Cipher Decoder applies one fixed shift instead of a repeating key and uses the same case-preserving, nonletter-passthrough convention. That tool is a useful sanity check: if a key of length one behaves the same as a Caesar shift of that value, the Vigenere setup is wired correctly.
Where Vigenere Fits, and Where It Doesn't
Vigenere is a great teaching tool. It demonstrates modular arithmetic, it shows how a sequence of weak ciphers can be combined into something that looks irregular, and it produces ciphertext that an untrained eye cannot read. It is a regular feature in escape-room clues, classroom exercises, geocaching hints, and recreational puzzle hunts, and the same pattern shows up in introductions to cryptanalysis because a repeating key leaks structure that frequency analysis and key-length estimators can attack.
It is not a security tool. The repeating key is short, so the cipher is vulnerable to classical attacks and modern computers can test likely keys quickly. The tool itself does not try to find a key, score possible plaintexts, or run a dictionary search; it requires the correct key on the first try. For passwords, authentication tokens, financial details, personal records, or any data whose disclosure would matter, the right choice is a maintained modern encryption system with authenticated encryption and proper key management, such as the AES Encryption Online tool on this site. Vigenere belongs in the classroom and the puzzle book, not in the credential vault.
When sharing a Vigenere puzzle, also share the exact alignment convention. Two programs that agree on the alphabet can still disagree on whether a space consumes a key position, and the disagreement silently scrambles every letter after the first mismatch. The tool's convention is the one described in this article: only ASCII letters advance the key, every other code unit passes through unchanged, and source letter case is preserved. Anyone using this tool on both ends will see matching output, which is the whole point of locking the rule in once and stating it clearly.
For a deeper look, see XOR Cipher Calculator: Encrypt and Decrypt Text Online.