Vigenere Cipher

A Vigenere cipher shifts each letter by a different amount set by a keyword, so ATTACKATDAWN with the key LEMON becomes LXFOPVEFRNHR.

Input

Using key LEMON (5 letters).

Direction

Works on A to Z. Case is kept; other characters are left as typed and do not use a key letter.

Encoded with key LEMON

Key over your text

Type some text to see the key under each letter.

Vigenere square (tabula recta)

Row = key letter, column = plain letter, cell = coded letter. Rows for your key letters L, E, M, O, N are marked.
Key letterABCDEFGHIJKLMNOPQRSTUVWXYZ
AABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZA
CCDEFGHIJKLMNOPQRSTUVWXYZAB
DDEFGHIJKLMNOPQRSTUVWXYZABC
E, key rowEFGHIJKLMNOPQRSTUVWXYZABCD
FFGHIJKLMNOPQRSTUVWXYZABCDE
GGHIJKLMNOPQRSTUVWXYZABCDEF
HHIJKLMNOPQRSTUVWXYZABCDEFG
IIJKLMNOPQRSTUVWXYZABCDEFGH
JJKLMNOPQRSTUVWXYZABCDEFGHI
KKLMNOPQRSTUVWXYZABCDEFGHIJ
L, key rowLMNOPQRSTUVWXYZABCDEFGHIJK
M, key rowMNOPQRSTUVWXYZABCDEFGHIJKL
N, key rowNOPQRSTUVWXYZABCDEFGHIJKLM
O, key rowOPQRSTUVWXYZABCDEFGHIJKLMN
PPQRSTUVWXYZABCDEFGHIJKLMNO
QQRSTUVWXYZABCDEFGHIJKLMNOP
RRSTUVWXYZABCDEFGHIJKLMNOPQ
SSTUVWXYZABCDEFGHIJKLMNOPQR
TTUVWXYZABCDEFGHIJKLMNOPQRS
UUVWXYZABCDEFGHIJKLMNOPQRST
VVWXYZABCDEFGHIJKLMNOPQRSTU
WWXYZABCDEFGHIJKLMNOPQRSTUV
XXYZABCDEFGHIJKLMNOPQRSTUVW
YYZABCDEFGHIJKLMNOPQRSTUVWX
ZZABCDEFGHIJKLMNOPQRSTUVWXY

Why use our Vigenere Cipher Encoder and Decoder?

The Key Over Every Letter

The Key over your text card prints the key letter above each letter it shifts and leaves a gap over spaces and punctuation, so you can follow every step.

Square With Your Rows Marked

The full 26 by 26 Vigenere square sits under the tool, with the rows for your key letters marked so you can check a letter by hand.

Message and Key Stay Here

The cipher runs on your device. Your message and your key are not sent anywhere or saved: a reload starts with an empty message and the key back at LEMON.

What is the Vigenere Cipher?

The Vigenere cipher is a polyalphabetic cipher: it shifts each letter of a message by a different amount, set by a keyword written again and again over the text. Key letter A shifts by 0, B by 1 and so on up to Z, which shifts by 25. Wikipedia describes it as a special case of polyalphabetic substitution (Wikipedia).

Only the key's letters count, in any case: Le-mon 1 works as LEMON. The note under the Key box says how many other characters were ignored. A key with no letters A to Z gives no output, only a prompt to add one. The key repeats as often as the message needs, so a short key covers a message of any length.

Vigenere Cipher Decoder: Decrypt with the Key

  • The formula:Encode adds the key letter, with A = 0: C = (P + K) mod 26. Decode takes it away: P = (C - K + 26) mod 26.
  • Worked example:As a Vigenere decoder, LXFOPVEFRNHR with LEMON gives back ATTACKATDAWN: L minus L is A, X minus E is T, F minus M is T, O minus O is A, P minus N is C.
  • Wrong output:Gibberish out usually means a wrong key or the wrong direction. Check both.
  • Case and symbols:Letters keep their case. Spaces, digits and punctuation stay as typed and do not use a key letter: Attack at dawn! becomes Lxfopv ef rnhr!.
  • Key letters used:Under the key view, Key letters used lists the key as it was applied: LEMON over ATTACK AT DAWN gives LEMONLEMONLE. With long text the view shows the first 120 characters.

Common Use Cases

Puzzle Hunts and Escape Rooms

Hide a clue behind a keyword that players find elsewhere in the room, and check that it decodes cleanly before the game starts.

Cryptography Lessons

Show a class how a repeating key turns one plain letter into several coded letters, with the square and the key view side by side.

Checking Work Done by Hand

Encrypt a message on paper with the tabula recta, then type it here with the same key to confirm every letter.

Reading a Message With Its Key

Someone sent you coded text and the keyword. Paste the text, type the key, press Decode and read the plain message.

Geocache and Treasure Hunt Clues

Code a hint in letters while the digits of a time or a number stay as typed, so only the words are hidden.

Seeing Why It Was Broken

Encode a long message with a short key and look for repeated letter groups, the clue Kasiski used to work out the key length.

How to Use the Vigenere Cipher Encoder

1

Type the message

Type or paste the message into Text. Capital and small letters both work, and each keeps its case.

2

Enter the key word

Type a key word into Key. The note under the box shows the key in use and how many characters that are not A to Z it ignored.

3

Encode or Decode

Press Encode to encrypt or Decode to decrypt. The output updates as you type, so you can change the key and watch it change.

4

Copy and check

Press Copy encoded text or Copy decoded text. The Key over your text card shows which key letter shifted each letter.

A Polyalphabetic Cipher: Why It Beats Caesar

Several Alphabets at Once

Each key letter is its own shifted alphabet, so one plain letter becomes different letters: the 4 As of ATTACKATDAWN become L, O, E, N.

Caesar Is the One-Letter Case

A one-letter key is a Caesar cipher: key D turns Hello into Khoor, a shift of 3.

Still Breakable

A repeating key leaves repeated letter groups in a long message. Those repeats give away the key length, after which each column is only a Caesar shift, so keep it for puzzles and learning.

Who Invented It: Bellaso 1553, Vigenère and Kasiski 1863

  • •1553: Giovan Battista Bellaso first described the cipher in 1553. In the 19th century it was misattributed to Blaise de Vigenère.
  • •1586: Vigenère published a different cipher, an autokey cipher, in 1586.
  • •Its nickname: It earned the name le chiffrage indéchiffrable, the indecipherable cipher (Wikipedia).
  • •1863: Friedrich Kasiski published the first general attack in 1863, using repeated letter groups to guess the key length (Kasiski examination).

Encode a Message With Your Keyword

Setting a puzzle, checking homework or reading a note a friend coded with a shared keyword, this free Vigenere cipher tool encrypts and decrypts as you type and shows the key under every letter.

Scroll up, type your text and your key, and pick Encode or Decode. There is nothing to install and no account to make.

The Vigenere Square (Tabula Recta)

Encoding by Hand

In the Vigenere square above, find the row for the key letter and the column for the plain letter. Row L, column A is L.

Decoding by Hand

Go along the key letter's row to the coded letter; the letter at the top of that column is the plain letter. In row E, X sits in column T.

Where the Square Comes From

Johannes Trithemius published the tabula recta in Polygraphia in 1518 (Wikipedia).

Related tools

Frequently Asked Questions

How do I decode a Vigenere cipher with a key?

Paste the coded text, type the same key and press Decode. LXFOPVEFRNHR with LEMON gives ATTACKATDAWN.

Can you decode a Vigenere cipher without the key?

Not with this tool; it needs the key. Kasiski examination guesses the key length from repeated letter groups in a long message, and each column is then a Caesar shift.

What happens to spaces and punctuation?

They are kept as typed and do not use up a key letter, so Attack at dawn! with LEMON gives Lxfopv ef rnhr!.

Who invented the Vigenere cipher?

Giovan Battista Bellaso described it in 1553. It was later misattributed to Blaise de Vigenere, who published a different autokey cipher in 1586.

Is the Vigenere cipher secure?

No. Friedrich Kasiski published a general attack in 1863. Use it for puzzles and learning, not for secrets.

What key gives back the same text?

The key A, because A shifts by 0: Hello stays Hello. Any one-letter key is a Caesar shift.