How the keyword drives the shift
The Vigenère cipher is a polyalphabetic substitution: instead of one shift for the whole message, each letter gets the shift named by the next letter of the key. A in the key means shift 0, B means 1, up to Z meaning 25. The key repeats for as long as the text runs, so with the key LEMON the first letter shifts by 11, the second by 4, the third by 12, and the sixth is back to 11.
Before use, the key is uppercased and everything that is not A to Z is stripped, so le-mon 1 and LEMON behave identically. If the key contains no letters at all, there is nothing to shift by and the text comes back unchanged rather than erroring.
The key index advances only when a letter is actually shifted. Spaces and punctuation are copied through without consuming a key letter, which is why ATTACK AT DAWN and ATTACKATDAWN produce the same letter sequence. That matches the textbook worked example and keeps a round trip exact: encode then decode with the same key returns the original characters, including layout.
Encoding and decoding share one code path, with Decode negating each shift. Because the operation is a shift modulo 26, decoding with the same key is the exact inverse; decoding with the wrong key returns letters, just not the right ones. A one-letter key such as D degenerates to a Caesar shift of 3.
How to use vigenère cipher
- 1Type the keyword you want to use into the Key field in the action bar.
- 2Paste the text you want to encode into the input panel.
- 3Read the enciphered result in the output panel, then copy or download it.
- 4To read a message, paste the ciphertext and turn Decode on with the same key.
- 5Turn on Letters Only to drop spaces and punctuation from the output.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
One shift per key letter
Each letter of the text is shifted by the position of the next key letter in the alphabet, A = 0 through Z = 25, and the key repeats for the length of the text. A single-letter key collapses to a fixed Caesar shift.
Key is normalised before use
The key is uppercased and stripped of everything outside A to Z, so le-mon 1 equals LEMON. A key with no letters leaves the text unchanged instead of erroring.
Non-letters pass through and do not advance the key
Digits, spaces, punctuation, and accented characters such as é are copied straight to the output, and the key pointer stays put. Spacing therefore does not change which key letter a given letter receives.
Case survives the shift
Keep Case is on by default, so an uppercase letter comes out uppercase and a lowercase letter comes out lowercase. Turn it off to force the whole result to lowercase, matching the Caesar cipher behaviour.
Optional letters-only output
Letters Only removes every non-letter from the result, producing the unbroken ciphertext string classical examples use. It applies to the output only; the decode step still works on it because spacing was never load-bearing.
Worked example
Key LEMON, Decode off. The space is copied through without taking a key letter, so the letters match the textbook LXFOPVEFRNHR. Paste the result back with Decode on and the same key to recover the plaintext.
ATTACK AT DAWN
LXFOPV EF RNHR
Settings reference
| Setting or behaviour | Effect on output |
|---|---|
Key (default KEY) |
Keyword driving the shifts. Uppercased, non-letters stripped. An empty or letterless key leaves the text unchanged. |
| Decode (default off) | Negates every shift, turning ciphertext back into plaintext with the same key. |
| Keep Case (default on) | Preserves upper and lower case. Off forces the whole output to lowercase. |
| Letters Only (default off) | Drops spaces, digits, and punctuation from the output, leaving letters alone. |
| Alphabet | Only A to Z is shifted. Accented and non-Latin characters pass through unchanged. |
| Key advance | The key pointer moves only on shifted letters, so punctuation never consumes a key letter. |
FAQ
How do I decode a Vigenère cipher?
What happens to spaces and punctuation?
ATTACK AT DAWN gives the same letters as ATTACKATDAWN. Turn on Letters Only to strip them from the result.How is this different from a Caesar cipher?
Is the Vigenère cipher secure?
What if I leave the key blank?
123, and --- all leave nothing to shift by. With Letters Only on you still get the letters-only version of your input.