How to use the vigenere cipher
- Enter your plaintext or ciphertext in the Text field.
- Choose Encode or Decode from the direction menu.
- Type a keyword made of letters into the Keyword field.
- Decide whether to keep or strip spaces and punctuation with the checkbox.
- Read the output and the key stream alignment row below it.
How the Vigenere cipher works
The vigenere cipher is a polyalphabetic substitution method that uses a repeating keyword to shift letters. Each letter of the keyword determines how far the corresponding plaintext letter moves forward in the alphabet. The formula for encoding is C = (P + K) mod 26, where P is the plaintext letter index (A=0, B=1, ..., Z=25) and K is the keyword letter index.
For decoding the formula reverses: P = (C - K + 26) mod 26. Consider the classic example of encoding ATTACKATDAWN with the keyword LEMON. The first letter A (0) plus L (11) gives 11, which is L. The second letter T (19) plus E (4) gives 23, which is X. Continuing this process produces LXFOPVEFRNHR.
Key stream alignment explained
One feature of this vigenere cipher calculator is the key stream alignment row. Because the keyword repeats over the length of the message, it helps to see exactly which keyword letter applies to each character. Non-letter characters like spaces and punctuation can either be stripped or preserved. When preserved, they do not consume a keyword letter, so the alignment stays consistent with the actual letters being encrypted.
For example, encoding HELLO WORLD with keyword KEY while keeping spaces produces:
| Plaintext | H | E | L | L | O | W | O | R | L | D | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Key stream | K | E | Y | K | E | Y | K | E | Y | K | |
| Ciphertext | R | I | J | V | S | U | Y | V | J | N |
Reference table of single-letter shifts
Each keyword letter corresponds to a fixed shift value. This table shows the shift for every letter of the alphabet, which is useful when working through a vigenere cipher encoder or decoder manually.
| Key letter | Shift | Key letter | Shift | Key letter | Shift |
|---|---|---|---|---|---|
| A | 0 | J | 9 | S | 18 |
| B | 1 | K | 10 | T | 19 |
| C | 2 | L | 11 | U | 20 |
| D | 3 | M | 12 | V | 21 |
| E | 4 | N | 13 | W | 22 |
| F | 5 | O | 14 | X | 23 |
| G | 6 | P | 15 | Y | 24 |
| H | 7 | Q | 16 | Z | 25 |
| I | 8 | R | 17 |
Historical background and security
The vigenere cipher was long considered unbreakable and earned the nickname le chiffre indechiffrable. Blaise de Vigenere popularized it in the 16th century, though Giovan Battista Bellaso described a similar method earlier. Unlike a simple Caesar cipher translator which uses one fixed shift, the Vigenere method changes the shift for every letter based on the keyword.
In 1863 Friedrich Kasiski published a method for determining the keyword length by looking for repeated sequences in the ciphertext. Once the length is known, frequency analysis breaks each column independently. For serious modern encryption, algorithms far beyond classical ciphers are required, but the Vigenere cipher remains an excellent teaching tool for understanding polyalphabetic substitution.
Common mistakes to avoid
When using a vigenere cipher decoder, the most frequent error is including numbers or symbols in the keyword. Only letters carry meaning in the key; digits should be removed before encrypting. Another mistake is letting spaces advance the keyword position. If the sender keeps spaces but does not count them toward the key, and the receiver counts them, the decrypted text will be garbled.
Always agree with your recipient on whether non-letter characters are kept or stripped, and whether they consume a key position. This tool defaults to preserving non-letters without advancing the keyword, which is the most common convention. For other classical methods like the Playfair cipher or the rail fence cipher, different rules about spacing apply entirely.
Worked examples
| Example | Input | Result |
|---|---|---|
| Classic example | Text: ATTACKATDAWN; Direction: encode; Keyword: LEMON; Keep spaces and punctuation: no | Encoded text: LXFOPVEFRNHR; Key stream: LEMONLEMONLE |
| Decode the classic | Text: LXFOPVEFRNHR; Direction: decode; Keyword: LEMON; Keep spaces and punctuation: no | Decoded text: ATTACKATDAWN; Key stream: LEMONLEMONLE |
| Sentence with spaces | Text: Hello World; Direction: encode; Keyword: KEY; Keep spaces and punctuation: yes | Encoded text: Rijvs Uyvjn; Key stream: KEYKE YKEYK |
| Strip non-letters | Text: Meet at dawn!; Direction: encode; Keyword: SECRET; Keep spaces and punctuation: no | Encoded text: Eigkemveye; Key stream: SECRETSECR |
FAQ
What is a Vigenere cipher?
It is a method of encrypting alphabetic text by applying a series of different Caesar shifts based on the letters of a repeating keyword.
How do I use this vigenere cipher encoder?
Type your message, select Encode, enter a keyword of letters, and the tool produces the ciphertext along with the key stream alignment.
Can the vigenere cipher decoder handle lowercase letters?
Yes. Lowercase letters are shifted using the same keyword values and remain lowercase in the output.
Do spaces and punctuation affect the keyword position?
By default this tool keeps spaces and punctuation but does not advance the keyword for them. You can uncheck the option to strip non-letters entirely.
Is the Vigenere cipher secure for real secrets?
No. It was broken in the 19th century using Kasiski examination and frequency analysis. It is suitable for puzzles and education, not real security.
How is this different from a Caesar cipher?
A Caesar cipher uses one fixed shift for every letter. The Vigenere cipher changes the shift per letter according to a keyword, making frequency analysis harder.
Does this tool upload my text anywhere?
No. The vigenere cipher calculator runs entirely in your browser. Nothing is sent to a server.