Vigenere Cipher Calculator - Encrypt or Decrypt with a Keyword

vigenere cipher calculator for encrypting or decrypting text with a repeating keyword and a visible Vigenere square row showing the shift lookup.

Updated: June 20, 2026 • Free Tool

Vigenere Cipher Calculator

Encrypt adds the keyword shift to each letter index. Decrypt subtracts the keyword shift to recover plaintext.

Keyword that drives the per-letter Caesar shift. Non-letters are stripped; A is shift 0, Z is shift 25.

Preserve case keeps the input casing. Force uppercase or force lowercase rewrites the shifted letter.

Letters are shifted by the repeating keyword; digits, spaces, and punctuation pass through unchanged and do not consume a keyword letter.

Results

Vigenere Output
0
Letters Shifted 0letters
Non-Letter Characters 0characters
Keyword Letters Used 0letters
Vigenere Square Row 0

What Is Vigenere Cipher Calculator?

A vigenere cipher is a polyalphabetic substitution cipher that encrypts plaintext by adding a series of Caesar shifts drawn from a repeating keyword, and decrypts the same ciphertext by subtracting those shifts in reverse.

  • Encrypting a message with a known keyword: Type a plaintext message and a shared keyword so a partner can decrypt the result with the same keyword and direction.
  • Decoding intercepted ciphertext: Paste the ciphertext and the keyword the sender used to recover the original message without retyping the alphabet by hand.
  • Teaching polyalphabetic substitution: Walk through how each keyword letter produces a different Caesar shift so the same letter maps to multiple cipher letters.
  • Building a reusable passphrase for short notes: Turn a memorable phrase into a keyword and use it to obfuscate grocery lists, journal snippets, or puzzle clues.

Because the calculator repeats the keyword over the message and leaves digits, spaces, and punctuation untouched, the same form handles sentences, IDs, and short URLs without changing the visible format.

The result panel shows the polyalphabetic output, the letters shifted, the non-letter counts, how many keyword letters the cipher consumed, and the Vigenere square row that produced the most recent shift.

Because the Vigenere cipher is built from repeated Caesar shifts, the caesar cipher shifter is the closest peer for understanding how the per-letter shift works when the keyword length drops to one.

How Vigenere Cipher Calculator Works

The cipher normalizes the keyword to a sequence of letter shifts, walks the input one character at a time, and adds or subtracts the active keyword shift from each letter index modulo 26 so the output wraps from Z back to A.

Keyword shift: shift = keywordLetter - 65 (range 0..25) Encrypt: shiftedIndex = (letterIndex + shift) mod 26 Decrypt: shiftedIndex = (letterIndex - shift) mod 26 Letter: out = String.fromCharCode(base + shiftedIndex) (base = 65 for uppercase, 97 for lowercase)
  • input_text: The plaintext or ciphertext. Letters are shifted by the repeating keyword; digits, spaces, and punctuation pass through and do not consume a keyword letter.
  • keyword: The repeating keyword. Non-letters are stripped and the remaining letters drive a per-position shift of A=0 through Z=25.
  • direction: Encrypt adds the active keyword shift to each letter index. Decrypt subtracts it, recovering plaintext with the same keyword.
  • case_preserved: Preserve case keeps the input casing and tracks the matching ASCII base. Force uppercase or force lowercase rewrites the shifted letter.

The lookup table behind the cipher is the Vigenere square, where row shift gives the cipher letter for plain letter P. The calculator exposes the last row it used so you can see the exact mapping that produced the final character.

Encrypt ATTACKATDAWN with the keyword LEMON

Input = 'ATTACKATDAWN', Direction = Encrypt, Keyword = LEMON, Case = Preserve

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. C (2) + N (13) = 15 -> P. K (10) + L (11) = 21 -> V. A (0) + E (4) = 4 -> E. T (19) + M (12) = 5 -> F. D (3) + O (14) = 17 -> R. A (0) + N (13) = 13 -> N. W (22) + L (11) = 7 -> H. N (13) + E (4) = 17 -> R.

Vigenere output: LXFOPVEFRNHR. Letters shifted: 12. Non-letter characters: 0.

Reproduces the Wikipedia ATTACKATDAWN with LEMON example that defines the polyalphabetic cipher.

According to Wikipedia: Vigenere cipher, this method of encryption uses a series of interwoven Caesar ciphers based on the letters of a keyword, so ATTACKATDAWN with keyword LEMON becomes LXFOPVEFRNHR.

When the message needs to travel as numbers, the ASCII converter shows the same Latin alphabet as decimal, hex, octal, or binary codes so the keyword can be sent as bytes alongside the ciphertext.

Key Concepts Explained

Four ideas explain how a polyalphabetic cipher differs from a single-shift cipher.

Repeating Keyword

The keyword drives the per-letter shift. A=0, B=1, and so on through Z=25, so each keyword letter tells the cipher how far to rotate the alphabet for the next letter. Non-letters are stripped so the keyword always resolves to a valid shift array.

Modulo 26 Wrap-Around

Letter positions run from 0 (A) to 25 (Z). Adding the keyword shift modulo 26 keeps every result in range, so wrap-around from Z back to A is automatic. Subtraction uses ((index - shift) mod 26 + 26) mod 26 to handle negative intermediates.

Vigenere Square (Tabula Recta)

The Vigenere square is a 26 by 26 table whose row for shift s is the alphabet rotated by s positions. Picking the row whose index matches the active keyword letter gives the per-letter substitution.

Letter-Case and Non-Letter Handling

Uppercase letters use ASCII base 65 and lowercase letters use base 97, so the shift applies to the matching letter range. Digits, spaces, and punctuation pass through unchanged and do not advance the keyword index.

These four ideas also explain why the cipher is harder to crack than the Caesar cipher: the same plaintext letter maps to different ciphertext letters depending on the keyword position, which spreads English letter frequencies across the output.

For a class that already knows the alphabet ring idea, the modulo calculator walks through the same wrap-around step on the 26-letter ring, so the manual keyword-shift math matches what the cipher does automatically.

How to Use This Calculator

Five steps walk through both directions with the same form.

  1. 1 Choose Encrypt or Decrypt: Encrypt adds the keyword shift. Decrypt subtracts it so the same form reverses the cipher without retyping the input.
  2. 2 Type a keyword in the Keyword field: Use any letters, digits, or symbols. The calculator keeps only the letters and treats them as the repeating shift sequence (A=0, Z=25).
  3. 3 Pick a case-handling policy: Preserve case keeps the input casing. Force uppercase or force lowercase rewrites the shifted letter, useful when the output is pasted into a fixed-format text box.
  4. 4 Paste the message into Input Text: Type or paste the plaintext or ciphertext. The cipher accepts letters, digits, spaces, and punctuation; non-letter characters pass through and do not consume a keyword letter.
  5. 5 Read the Vigenere output and the counts: The result panel shows the polyalphabetic output, the letters and keyword letters applied, the non-letter pass-through, and the Vigenere square row that produced the final shift.

If you paste ATTACKATDAWN, set Direction to Encrypt, and type LEMON as the keyword, the calculator walks the message and looks up row 11 (L) for A, row 4 (E) for T, row 12 (M) for the next T, and so on. The output reads LXFOPVEFRNHR. Switching Direction to Decrypt with the same keyword runs the same lookups in reverse and restores ATTACKATDAWN.

When the Vigenere output needs to read like a sentence, the sentence case converter rewrites the letter casing for you, so you can run the cipher first and then normalize the result without retyping it by hand.

Benefits of Using This Calculator

This polyalphabetic tool keeps the keyword, the direction toggle, the Vigenere square, and the case handling in one place.

  • Encrypt and decrypt with the same form: Direction toggle adds the keyword shift for encrypt and subtracts it for decrypt, so you never need a separate decoder page.
  • Keyword auto-repeat with non-letter stripping: The calculator keeps only the letters in the keyword and repeats them across the message, ignoring digits, spaces, and punctuation in the input.
  • Visible Vigenere square row: The result panel prints the most recent Vigenere square row the keyword letter produced, so the lookup behind each shifted letter is visible.
  • Case handling with three policies: Preserve case keeps the input casing, while Force uppercase and Force lowercase normalize the output. The same policy works for encrypt and decrypt.
  • Pass-through of digits, spaces, and punctuation: The cipher only shifts the 26 Latin letters, so dates, phone numbers, IDs, and short URLs survive the round trip.

The visible Vigenere square row, the case handling option, and the keyword auto-repeat all work for both encrypt and decrypt, so the same form handles every common polyalphabetic cipher task.

If the goal is to confuse a casual reader in a different way, the mirror text converter produces the same string backwards, which composes with the cipher for layered obfuscation on a short note.

Factors That Affect Your Results

Three inputs shape what the output looks like, and two limitations tell you when to reach for a stronger cipher.

Keyword Length

A short keyword repeats often, which makes the cipher closer to a Caesar shift and easier to crack with frequency analysis. A longer keyword spreads the shifts further and resists the same attack.

Direction Toggle

Encrypt adds the keyword shift to each letter index; Decrypt subtracts it. Switching direction with the same keyword reverses the cipher, the property that lets a receiver read the message with only the keyword.

Case Handling

Preserve case keeps uppercase letters uppercase and lowercase letters lowercase. Force uppercase or force lowercase rewrites the shifted letter, useful when the output is pasted into a fixed-format text box.

  • The calculator covers the 26-letter Latin alphabet. Characters outside that range (accented letters, emoji, or non-Latin scripts) pass through unchanged rather than being shifted, so the calculator does not encrypt a full Unicode string.
  • The cipher is a teaching example, a hobby puzzle tool, and a way to obfuscate short messages, but it is not secure for modern encryption because classical attacks like the Kasiski examination recover the keyword length and frequency analysis recovers the keyword itself. Use a modern authenticated encryption protocol for sensitive messages.

Kasiski examination looks for repeated ciphertext segments that suggest the same plaintext ran under the same keyword offset, then takes the greatest common divisor of the distances between those repeats to estimate the keyword length.

According to Britannica: Vigenere cipher, this method applies a different Caesar shift to each letter of the plaintext, where the shift for each letter is taken from the corresponding letter of a repeating keyword.

According to Wikipedia: Kasiski examination, the Kasiski examination recovers the length of a Vigenere keyword by finding repeated segments in the ciphertext and computing the greatest common divisor of the distances between them, which is why short keywords do not keep the cipher secure.

When the keyword and ciphertext are meant for storage or transmission, the data storage converter can translate the resulting byte count into KB, MB, GB, or TB so you can size the message next to the rest of your payload.

vigenere cipher calculator interface showing plaintext input, keyword field, encrypt or decrypt toggle, case handling, and the visible Vigenere square row that drives each shift
vigenere cipher calculator interface showing plaintext input, keyword field, encrypt or decrypt toggle, case handling, and the visible Vigenere square row that drives each shift

Frequently Asked Questions

Q: What is the vigenere cipher?

A: It is a polyalphabetic substitution cipher that encrypts plaintext by applying a series of Caesar shifts drawn from a repeating keyword. Each keyword letter A-Z maps to a shift of 0-25, so the same plaintext letter can map to different ciphertext letters depending on the keyword position.

Q: How do you encrypt a message with the vigenere cipher?

A: Set Direction to Encrypt, type a keyword, and paste the plaintext into Input Text. The calculator walks the message, repeats the keyword across the letters, and adds the active keyword shift to each letter index modulo 26, so ATTACKATDAWN with LEMON becomes LXFOPVEFRNHR.

Q: How do you decrypt vigenere cipher text back to plaintext?

A: Paste the ciphertext, set Direction to Decrypt, and use the same keyword the sender used. The calculator subtracts the keyword shift instead of adding it, so LXFOPVEFRNHR with LEMON reads back as ATTACKATDAWN. Without the keyword, try Kasiski examination or a frequency-analysis tool.

Q: What is the difference between this cipher and the caesar cipher?

A: The Caesar cipher uses a single fixed shift for every letter, so the same plaintext letter always maps to the same ciphertext letter. The polyalphabetic version uses a different shift for each position, taken from the repeating keyword, so the same plaintext letter can map to several ciphertext letters.

Q: How does the vigenere square (tabula recta) work?

A: The square is a 26 by 26 table whose row for shift s is the alphabet rotated by s positions. To encrypt, find the row whose index matches the active keyword letter and read the cipher letter in the column of the plaintext letter.

Q: Is this cipher secure for modern encryption?

A: No. It is a teaching example, a hobby puzzle tool, and a way to obfuscate short messages, but it is not secure because Kasiski examination recovers the keyword length from repeated ciphertext segments and frequency analysis usually recovers the keyword itself after a short paragraph.