Vigenère Cipher Encoder/Decoder

Encode and decode messages with the classic Vigenère keyword cipher.

Result

Lxfopv ef rnhr

How it is calculated

The Vigenère cipher shifts each letter of the text by an amount taken from a repeating keyword. Each keyword letter is turned into a shift from 0 to 25 (A = 0, B = 1, … Z = 25). For a plaintext letter P and key shift K, encoding gives C = (P + K) mod 26, and decoding gives P = (C − K) mod 26. The key is used letter by letter and starts over when it ends. It only moves forward on letters: spaces, digits and punctuation are copied unchanged and do not use up a key letter. Upper and lower case are kept as typed. Only A to Z count, so accented or non-English letters in the key are ignored and in the text are left as they are. A key with no usable letters returns nothing.

Worked example

Encode "Attack at dawn" with the key LEMON. The key letters give shifts L = 11, E = 4, M = 12, O = 14, N = 13, repeating. A + 11 = L, t + 4 = x, t + 12 = f, a + 14 = o, c + 13 = p, k + 11 = v (the key starts over at L). The space is copied and does not use a key letter. Continuing gives the full result: Lxfopv ef rnhr. Choosing decode with the same key and this text returns "Attack at dawn".

Try this example →

Common mistakes

  • Decoding with the encode setting (or the other way round). The same key then shifts letters further instead of undoing the shift.
  • Thinking spaces use up key letters. They do not, so a puzzle solved by counting positions that include spaces will not match.
  • Putting digits or punctuation in the key and expecting them to count; they are ignored, so "KEY2" acts like "KEY".
  • Expecting accented letters such as é or ğ to be enciphered. Only the 26 basic letters are shifted; others pass through unchanged.

About this calculator

This tool encrypts or decrypts text with the Vigenère cipher, a polyalphabetic substitution cipher that shifts each letter of the plaintext by an amount determined by the corresponding letter of a repeating keyword, using what's known historically as the tabula recta. Because the shift changes from letter to letter, it defeats simple frequency analysis that breaks single-shift ciphers like Caesar's.

Used for centuries as a "le chiffre indéchiffrable," it's now mainly a teaching tool for cryptography students, puzzle and CTF (capture-the-flag) enthusiasts, and hobbyists exploring classical ciphers. Enter your text and a keyword, choose encrypt or decrypt, and get the result instantly.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators