Vigenère cipher — encrypt and decrypt with a keyword

Enter a message and a keyword to encrypt it with the Vigenère cipher, or switch to Decrypt to read one. Capital letters, punctuation and spacing stay where they were.

Live demo · real result from this tool
Direction
Letters only; non-letters in the message pass through and do not use up key letters.

Encoded

Lxfopv ef rnhr

Processed on your device — nothing is uploaded.

How to use the Vigenère cipher tool

  1. Choose the Direction: Encrypt or Decrypt.
  2. Type or paste your message into Input.
  3. Enter the Keyword. Only its letters count.
  4. Read the result below and copy it. To check your work, switch the direction and paste the result back in with the same keyword.

What it does and when to use it

The Vigenère cipher hides a message by shifting each letter by a different amount, set by a repeating keyword. It is a standard example in cryptography lessons, a favourite in puzzle hunts and geocaching, and a step up from simple shift ciphers.

It is important to be clear: this is a historical cipher, not modern encryption. It does not protect real data. For a fixed shift, use the Caesar cipher; for a simple letter mirror, try the Atbash cipher. If you want to compare a version where the message itself extends the key, see the autokey Vigenère cipher.

How it works

Number the letters A = 0, B = 1 … Z = 25. The keyword is repeated along the letters of the message:

  • Encrypt: C = (P + K) mod 26
  • Decrypt: P = (C − K + 26) mod 26

P is the plaintext letter, K the keyword letter and C the ciphertext letter. With the keyword LEMON, the first letter shifts by 11 (L), the next by 4 (E), then 12, 14 and 13, and the pattern repeats.

This tool keeps each letter’s case, skips anything that is not A–Z or a–z, and only moves to the next keyword letter after it has used one on a real letter. It runs in your browser.

Worked examples

ATTACK AT DAWN              key LEMON  →  LXFOPV EF RNHR
Meet me at 9, by the gate!  key KEY    →  Wicd qc kx 9, zi xfo kydi!
Wicd qc kx 9, zi xfo kydi!  key KEY, Decrypt  →  Meet me at 9, by the gate!
abc                         key 123    →  The keyword needs at least one letter A–Z.

The first line is the classic textbook example. In the second, “9,” and the spaces are copied across and the keyword K-E-Y keeps cycling over the letters only. The third line reverses it. The last shows the error you get when the keyword contains no letters.

Limits and tips

  • Longer, non-repeating keywords are harder to break, but even a long keyword does not make the cipher safe.
  • Agree with the other person on how spaces and punctuation are handled. This tool passes them through without using the key.
  • Letters outside A–Z, including accented letters and other scripts, are not encrypted. Remove or replace them first if they would give the message away.

Frequently asked questions

Is the Vigenère cipher secure?
No. It was hard to break by hand for a long time, but methods from the 1800s find the keyword length by spotting repeated patterns, and a computer breaks typical messages in seconds. Use it for puzzles, escape rooms and teaching, never for real secrets.
Does the keyword's case matter?
No. LEMON, lemon and Lemon give the same result. Anything in the keyword that is not a letter A–Z, such as digits, spaces or accents, is ignored. A keyword with no letters at all gives an error.
Why didn't the spaces change the result?
Only the letters A–Z and a–z are encrypted, and only they move the keyword forward. Spaces, digits and punctuation pass through untouched. Some other tools let spaces use up key letters, so the same message and key can give a different result there.
What happens to accented letters like é?
They are left exactly as they are and do not use a keyword letter, because the cipher works on the 26 letters of the basic Latin alphabet only.
How is this different from a Caesar cipher?
A Caesar cipher shifts every letter by the same amount. Vigenère changes the shift from letter to letter, following the keyword, so the same plaintext letter can become different ciphertext letters.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close