Vigenère Cipher Calculator

Encrypt or decrypt text with the Vigenère cipher — enter a message and keyword to see each letter shifted using the repeating-key tabula recta.

Quick Facts

Formula
Ci = (Pi + Ki) mod 26; decryption uses Pi = (Ci - Ki) mod 26
A=0, B=1, ... Z=25; the keyword repeats across the whole message.
Classic example
ATTACKATDAWN + key LEMON → LXFOPVEFRNHR
Spaces and punctuation are always passed through unchanged.

Your Results

Calculated
Output text
-
Encrypted or decrypted result
Letters shifted
-
A-Z characters processed
Keyword length
-
Letters in the repeating key
Characters passed through
-
Spaces, digits, punctuation kept as-is

Ready

Enter text and a keyword, choose Encrypt or Decrypt, then press Calculate.

About the Vigenère Cipher

The Vigenère cipher is a classical polyalphabetic substitution cipher first described in the 16th century. Instead of shifting every letter by the same amount (like a Caesar cipher), it shifts each letter by a different amount determined by a repeating keyword. That variation is what makes it far harder to break by simple frequency analysis than a single-shift cipher.

The formula

Every letter A-Z is assigned a numeric value: A=0, B=1, C=2, ... Z=25. To encrypt, each plaintext letter Pi is combined with the matching keyword letter Ki (repeated to cover the whole message) using modular addition:

  • Encryption: Ci = (Pi + Ki) mod 26
  • Decryption: Pi = (Ci - Ki + 26) mod 26

The "mod 26" simply wraps the result back into the alphabet whenever the sum runs past Z (or below A). Spaces, digits, and punctuation are not part of the 26-letter alphabet, so this calculator copies them through unchanged and does not advance the keyword position for them — the standard convention. Letter case in the input is preserved in the output.

Worked example

Encrypting ATTACKATDAWN with the keyword LEMON: the keyword repeats as LEMONLEMONLE to line up with all twelve letters. A(0)+L(11)=11=L, T(19)+E(4)=23=X, T(19)+M(12)=31 mod 26=5=F, A(0)+O(14)=14=O, and so on, producing LXFOPVEFRNHR. Decrypting that ciphertext with the same keyword subtracts instead of adds and recovers ATTACKATDAWN exactly.

How to use this calculator

  • Paste or type your message into Message text — plaintext to encrypt, or ciphertext to decrypt.
  • Enter a keyword of one or more letters; any non-letter characters in the keyword itself are ignored.
  • Choose Encrypt or Decrypt, then press Calculate. The keyword cycles automatically to cover the entire message.

Security note

The Vigenère cipher was considered unbreakable for centuries and earned the nickname "le chiffre indéchiffrable." It was eventually broken using Kasiski examination (finding repeated ciphertext fragments to estimate the keyword length) and later the index of coincidence method developed by Friedman. Today it is a teaching tool and puzzle cipher, not a secure one — real confidentiality needs a modern algorithm such as AES.

Frequently Asked Questions

How does the Vigenère cipher work?
Each letter of the keyword assigns a shift value (A=0, B=1, ... Z=25). To encrypt, every plaintext letter is shifted forward by the value of the matching keyword letter: Ci = (Pi + Ki) mod 26. The keyword repeats as many times as needed to cover the whole message. Decryption reverses the shift: Pi = (Ci − Ki) mod 26.
What happens to spaces, numbers, and punctuation?
Only letters A-Z are shifted. Spaces, digits, and punctuation are copied through unchanged and do not advance the keyword position, matching the classic Vigenère convention. Letter case is preserved in the output.
Is the Vigenère cipher secure?
No. It resisted casual cryptanalysis for centuries but was broken by Kasiski examination and Friedman's index of coincidence in the 1800s-1920s, which recover the keyword length from repeated letter patterns. It is a teaching and puzzle cipher today, not a secure one; modern encryption (AES) should be used for anything sensitive.
What is a worked example?
Encrypting ATTACKATDAWN with the keyword LEMON gives LXFOPVEFRNHR. For instance the first letter A (0) plus L (11) gives L; the second letter T (19) plus E (4) gives X, and so on, with the keyword LEMON repeating across all twelve letters.