A complete Vigenere cipher decoder example shows the modular arithmetic that maps each ASCII letter to the next one using a repeating A–Z key, with every nonletter character preserved unchanged. Decryption is the inverse of encryption: for each participating ASCII letter in the ciphertext, the tool subtracts the shift value of the matching key letter and takes the result modulo 26, then restores the original letter case. The key index advances only on ASCII letters, so spaces, digits, punctuation, emoji, and accented characters do not consume a key position. When the key is shorter than the message, the key repeats from its first character. With the correct key, decryption yields the original plaintext for every ASCII letter; with the wrong key, the result is still deterministic but produces meaningless text. This article walks through the arithmetic on a well-known pair from cryptography education, then shows how to reproduce the same answer with the Vigenere Cipher Decoder in your browser.

How the Modular Arithmetic Behind Vigenere Works
The repeating-key Vigenere cipher is built on a simple piece of modular arithmetic over the 26-letter English alphabet. Every uppercase ASCII letter is assigned a number from 0 to 25: A is 0, B is 1, C is 2, and so on, up to Z at 25. Lowercase letters use the same numeric scale and the result is converted back to the source case. The key is also reduced to a sequence of shift values, where A contributes 0, B contributes 1, and Z contributes 25. The key does not need to be uppercase: it is normalized internally so that lemon, LEMON, and Lemon all produce the identical shift sequence 11, 4, 12, 14, 13.
Encryption computes (letter + keyShift) mod 26. Decryption computes (letter − keyShift + 26) mod 26. The "+26" in decryption keeps the intermediate value non-negative before the modulo step. Each ASCII letter consumes exactly one shift from the key; when the key is shorter than the message, it wraps back to its first letter and continues. Characters that are not ASCII A–Z or a–z — spaces, line breaks, digits, punctuation, emoji, accented letters, CJK ideographs, and combining marks — are copied through verbatim and do not advance the key. That single rule about nonletter pass-through is the most common source of mismatch when comparing two different Vigenere implementations.
| Character type | Effect on key index | Effect on output |
|---|---|---|
| ASCII letter A–Z | Advances by 1 | Shifted, case preserved |
| ASCII letter a–z | Advances by 1 | Shifted, case preserved |
| Space, tab, line break | No change | Copied as-is |
| Digit (0–9) | No change | Copied as-is |
| Punctuation (! , . ? etc.) | No change | Copied as-is |
| Accented letter (é, ñ, ü) | No change | Copied as-is |
| Supplementary emoji (🎉, 🔑) | No change | Copied as-is |
| CJK ideograph (中, 日) | No change | Copied as-is |
A Worked Vigenere Cipher Decoder Example with LEMON
The classic education example uses the plaintext ATTACKATDAWN and the keyword LEMON. Both strings are ASCII letters, so the key advances once per character and no alignment questions arise. The keyword has five letters, so its shifts repeat to cover all twelve plaintext letters: L E M O N L E M O N L E, which in numeric form is 11, 4, 12, 14, 13, 11, 4, 12, 14, 13, 11, 4.
To encrypt, each plaintext letter is shifted forward by its key value, wrapping around Z back to A. The first plaintext letter A (0) plus key L (11) gives 11, which is L. The second plaintext letter T (19) plus key E (4) gives 23, which is X. The third plaintext letter T (19) plus key M (12) gives 31; taking 31 mod 26 gives 5, which is F. Continuing in the same way: A + O gives O, C + N gives P, K + L gives V, A + E gives E, T + M gives F, D + O gives R, A + N gives N, W + L gives H, and N + E gives R. The full ciphertext is therefore LXFOPVEFRNHR. This matches the well-known ATTACKATDAWN/LEMON pair found in textbooks and in the Cornell CS 1132 assignment on classical ciphers.
To decrypt that same ciphertext under the same key, the tool subtracts instead of adds. L (11) minus L (11) is 0, which is A. X (23) minus E (4) is 19, which is T. F (5) minus M (12) is −7; adding 26 gives 19, which is T. O (14) minus O (14) is 0, which is A. P (15) minus N (13) is 2, which is C. V (21) minus L (11) is 10, which is K. E (4) minus E (4) is 0, which is A. F (5) minus M (12) is −7 plus 26 = 19, which is T. R (17) minus O (14) is 3, which is D. N (13) minus N (13) is 0, which is A. H (7) minus L (11) is −4 plus 26 = 22, which is W. R (17) minus E (4) is 13, which is N. The result is ATTACKATDAWN, recovering the plaintext exactly.
How to Run the Same Example in the Vigenere Cipher Decoder
- Open the Vigenere Cipher Decoder in any modern browser. Nothing is installed and nothing is uploaded — the tool runs entirely inside the current tab.
- Paste the ciphertext LXFOPVEFRNHR into the text area. The input limit is 500,000 JavaScript UTF-16 code units, so a 12-letter example is well within bounds.
- Type the key LEMON (or lemon) into the key field. Keys are case-insensitive and must contain ASCII letters A–Z only, with a maximum of 256 letters.
- Select the Decrypt mode so the tool subtracts the key shifts instead of adding them.
- Click the run button. The output appears in a labeled result area, with the label plaintext reflecting the chosen mode.
- Use the Copy button to copy the recovered ATTACKATDAWN string, or paste your own plaintext and switch the mode to Encrypt to produce LXFOPVEFRNHR from it.
- If you change any input — text, key, or mode — the previous output and any error message are cleared immediately so stale results cannot be mistaken for a fresh transformation.
Why the Key-Alignment Rule Matters in a Real Example
The nonletter pass-through rule is what makes a worked decoder example reproducible across different programs. If the ciphertext had been written as LXF OPV EFR NHR with spaces, two different Vigenere tools might give different answers: one might advance the key across the spaces, the other (including the browser tool discussed here) would skip them and keep the alignment. The browser tool's behavior is locked in its interface label and tested explicitly, so the key index moves only on ASCII letters. Punctuation between two letters does not consume a key character, and the next ASCII letter picks up the next key shift. Readers who want a deeper walkthrough of this convention should see the guide on matching key alignment when reading a Vigenere cipher.
The same rule applies to accented letters. A message like café decrypts using only three key shifts (for c, a, f), because é is not an ASCII letter and is copied through unchanged. A supplementary-plane emoji such as 🎉 occupies two JavaScript UTF-16 code units but still does not consume a key letter, and it is preserved in the output exactly as it appeared in the input. This predictability matters when you are exchanging a puzzle or a homework answer with someone using a different program, because the only variable between implementations is usually the alignment rule for nonletters.
When a Vigenere Decoder Example Helps and When It Doesn't
A worked decoder example is the right tool for learning the modular arithmetic behind polyalphabetic substitution, for completing a classroom exercise, for solving an escape-room clue, or for verifying a hand calculation against a known answer. The Caesar Cipher Decoder covers the single-shift special case, while the Vigenere tool covers the repeating-key generalization. Both are useful for recreational puzzles and cryptography demonstrations, and both are presented in the CrypTool educational presentation as teaching examples of classical cipher mechanics.
A worked decoder example is the wrong tool when you do not have the key. The browser tool does not perform frequency analysis, does not estimate key length, does not run a dictionary search, and does not score candidate plaintexts. If you need to recover an unknown key from ciphertext, you are looking at cryptanalysis, which the tool deliberately does not attempt. It is also the wrong tool for protecting real secrets: the historical Vigenere cipher leaks statistical structure and is trivially broken by modern computers. Do not use it for passwords, authentication tokens, financial data, personal records, or any information whose disclosure would matter. Use a maintained modern encryption system with authenticated encryption and proper key management for anything security-sensitive.
If you're weighing options, How to Tell If an A1Z26 Cipher Translator Is the Right Tool covers this in detail.