Xerobit

Vigenere Cipher Encoder and Decoder

The Vigenere cipher encrypts text by shifting each letter according to a repeating keyword. Use this vigenere cipher calculator to encode or decode messages directly in your browser without uploading any data. It preserves letter case and lets you choose whether to keep or strip non-letter characters.

When checked, non-letters pass through unchanged and do not advance the keyword.

Result

LXFOPVEFRNHR
  • Encoded text
    LXFOPVEFRNHR
  • Key stream
    LEMONLEMONLE

    Shows how the keyword aligns with each character.

How to use the vigenere cipher

  1. Enter your plaintext or ciphertext in the Text field.
  2. Choose Encode or Decode from the direction menu.
  3. Type a keyword made of letters into the Keyword field.
  4. Decide whether to keep or strip spaces and punctuation with the checkbox.
  5. 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:

PlaintextHELLO WORLD
Key streamKEYKE YKEYK
CiphertextRIJVS UYVJN

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 letterShiftKey letterShiftKey letterShift
A0J9S18
B1K10T19
C2L11U20
D3M12V21
E4N13W22
F5O14X23
G6P15Y24
H7Q16Z25
I8R17

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

ExampleInputResult
Classic exampleText: ATTACKATDAWN; Direction: encode; Keyword: LEMON; Keep spaces and punctuation: noEncoded text: LXFOPVEFRNHR; Key stream: LEMONLEMONLE
Decode the classicText: LXFOPVEFRNHR; Direction: decode; Keyword: LEMON; Keep spaces and punctuation: noDecoded text: ATTACKATDAWN; Key stream: LEMONLEMONLE
Sentence with spacesText: Hello World; Direction: encode; Keyword: KEY; Keep spaces and punctuation: yesEncoded text: Rijvs Uyvjn; Key stream: KEYKE YKEYK
Strip non-lettersText: Meet at dawn!; Direction: encode; Keyword: SECRET; Keep spaces and punctuation: noEncoded 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.