Vigenère Cipher Decoder & Encoder

Encrypt and decrypt text with the Vigenère cipher, break ciphertext without the key using Kasiski examination and index of coincidence, and explore the interactive tabula recta with step-by-step examples.

"HELLO""RIJVS"(Key: KEY)

The Vigenère cipher is a polyalphabetic substitution cipher that encrypts text by shifting each letter using a repeating keyword. Invented in 1553 by Giovan Battista Bellaso, it resisted all known attacks for 300 years until Friedrich Kasiski published the first general break in 1863.

Vigenère cipher at a glance

Type
Polyalphabetic substitution cipher
Invented
1553 by Giovan Battista Bellaso
Named after
Blaise de Vigenère (16th century)
First broken
1863 by Friedrich Kasiski
Key space
26ⁿ for a keyword of length n
Security today
Breakable with modern cryptanalysis

Vigenère Tabula Recta Preview

The tabula recta is the 26x26 grid used for Vigenère encryption. Match the key letter with the plaintext letter and read the ciphertext at the intersection.

ABCDEF
AABCDEF
BBCDEFG
CCDEFGH
DDEFGHI
EEFGHIJ
FFGHIJK

Showing a 6x6 preview of the full 26x26 Vigenère table

Frequently Asked Questions About the Vigenère Cipher

What is the Vigenère cipher and how does it work?

The Vigenère cipher is a polyalphabetic substitution cipher that repeats a keyword over the plaintext. Each keyword letter sets a Caesar shift, so different positions in the message use different shifts.

How do you break a Vigenère cipher?

You first estimate the key length with Kasiski examination or index of coincidence, then treat each column as a Caesar cipher and use frequency analysis to recover the key.

What is a tabula recta in the Vigenère cipher?

The tabula recta is the 26x26 Vigenère table. Find the plaintext letter on one axis and the key letter on the other axis; their intersection gives the ciphertext letter.

Why was the Vigenère cipher once called indecipherable?

Because its repeating-key polyalphabetic design resisted the simple frequency analysis that broke monoalphabetic ciphers for centuries.

How is Vigenère different from Caesar?

Caesar uses one fixed shift for every letter. Vigenère changes the shift based on the repeating keyword, which makes repeated plaintext letters encrypt differently.

Is the Vigenère cipher the same as the Caesar cipher?

No. Caesar uses a single shift applied to every letter, so it is monoalphabetic. Vigenère applies a different Caesar shift at each position determined by a repeating keyword, making it polyalphabetic. A Vigenère cipher whose keyword is a single letter reduces to a Caesar cipher.

How do you choose a good Vigenère key?

Use a longer, less predictable keyword with varied letters. Short or repetitive keys create stronger patterns and are easier to break.

Is the Vigenère cipher secure today?

No. Modern cryptanalysis and computers can break classical Vigenère ciphertext quickly, but it remains useful for learning historical cryptography.

Who invented the Vigenère cipher?

The method usually called the Vigenère cipher was described earlier by Bellaso, while Blaise de Vigenère later published a related autokey variant.

What does polyalphabetic mean?

It means the cipher uses multiple substitution alphabets. In Vigenère, the keyword decides which alphabet applies at each position.

Can you decode Vigenère without the key?

Yes, if the ciphertext is long enough. Tools can estimate key length, rank candidate keys, and score likely plaintext automatically.

What is the Vigenère table used for?

It is a visual lookup grid for manual encryption and decryption. It also helps explain how each keyword letter changes the shift.

How is Vigenère different from a one-time pad?

A one-time pad uses a truly random key that is as long as the message and never reused. Vigenère repeats a shorter key, which creates patterns that can be attacked.

How do you pronounce "Vigenère"?

Vigenère is pronounced /ˌviːʒəˈnɛər/ — roughly "vee-zhuh-NAIR". It is named after Blaise de Vigenère, a 16th-century French diplomat, and the correct written form carries a grave accent over the second "e".

How do I implement the Vigenère cipher in Python?

A minimal implementation is a few lines: for each plaintext letter, compute (ord(p) - 65 + ord(k) - 65) % 26 + 65 and convert back to a character, cycling through the keyword. The code section on this page includes ready-to-copy Python, Java, and JavaScript implementations that preserve case and non-alphabet characters.

Where does the Vigenère cipher appear in pop culture?

The animated series Gravity Falls used Vigenère-encrypted messages in its end credits with a per-episode key, and the video game Destiny 2 hides Vigenère ciphers in its lore books. It also appears in numerous detective novels and puzzle hunts because it needs both a key and ciphertext — ideal for multi-step puzzle design.

What Is the Vigenère Cipher?

The Vigenère cipher is a polyalphabetic substitution cipher invented in 1553 by Giovan Battista Bellaso. It encrypts text by applying a different Caesar shift to each letter based on a repeating keyword. If the keyword is "KEY", the first letter shifts by 10 (K = 10), the second by 4 (E = 4), the third by 24 (Y = 24), then the pattern repeats. This means the same plaintext letter can encrypt to different ciphertext letters depending on its position — the defining feature that separates polyalphabetic ciphers from monoalphabetic ones like Caesar.

For over 300 years, from its invention in 1553 to its first published cryptanalysis in 1863, the Vigenère cipher was called "le chiffre indéchiffrable" — the indecipherable cipher. It defeated every known attack of its era by flattening the letter frequency distribution that makes single-alphabet ciphers trivially breakable. It was not until Friedrich Kasiski and independently Charles Babbage developed new statistical techniques that the cipher finally fell.

How the Vigenère Cipher Works

Encryption Formula

For each plaintext letter at position i, the encryption formula is:

Cᵢ = (Pᵢ + Kᵢ) mod 26

Where Pᵢ is the plaintext letter's position (A = 0, B = 1, … Z = 25), Kᵢ is the corresponding keyword letter's position, and mod 26 wraps the result within the alphabet.

Decryption Formula

Pᵢ = (Cᵢ − Kᵢ + 26) mod 26

Vigenère Cipher Example: Encrypt "ATTACK AT DAWN" with LEMON

Encrypt ATTACK AT DAWN with the keyword LEMON:

PositionPlaintextKey LetterP + Kmod 26Ciphertext
1A (0)L (11)1111L
2T (19)E (4)2323X
3T (19)M (12)315F
4A (0)O (14)1414O
5C (2)N (13)1515P
6K (10)L (11)2121V
7A (0)E (4)44E
8T (19)M (12)315F
9D (3)O (14)1717R
10A (0)N (13)1313N
11W (22)L (11)337H
12N (13)E (4)1717R

Result: ATTACK AT DAWN → LXFOPV EF RNHR

Notice that the two T's at positions 2 and 3 encrypt to different letters (X and F) because they align with different keyword letters (E and M). Similarly, the three A's at positions 1, 4, and 7 become L, O, and E respectively. This varying substitution is exactly what makes frequency analysis ineffective against polyalphabetic ciphers.

Tabula Recta: The Vigenère Square

The tabula recta (also called the Vigenère square or Vigenère table) is the 26×26 grid traditionally used to perform Vigenère encryption by hand. Each row represents a Caesar cipher with a different shift value — row A is shift 0, row B is shift 1, and so on.

To encrypt a letter using the tabula recta:

  1. Find the row corresponding to the keyword letter.
  2. Find the column corresponding to the plaintext letter.
  3. The letter at the intersection is the ciphertext letter.

The preview table on this page shows a 6×6 portion of the full grid. Explore the complete 26×26 tabula recta on our interactive Vigenère table page, where you can click any cell to see the encryption relationship.

Vigenère vs Caesar Cipher

The Vigenère cipher is often described as a polyalphabetic upgrade to Caesar. Here is how the two compare across the properties that matter for practical cryptanalysis:

PropertyCaesar cipherVigenère cipher
TypeMonoalphabeticPolyalphabetic
KeySingle integer shift (0–25)Keyword of any length
Key space26 possible keys26ⁿ for a keyword of length n
Vulnerable to simple frequency analysis?Yes — letter frequencies stay visibleNo — frequencies are flattened across positions
First general breakClassical antiquity1863 (Kasiski examination)
Best modern attackBrute force all 26 shiftsKasiski + index of coincidence + frequency analysis per column

A Vigenère cipher whose keyword is a single letter reduces to a Caesar cipher — Caesar is just Vigenère with n = 1. The jump to any keyword longer than one letter is what makes the cipher resist naive frequency analysis, because each position in the message draws from a potentially different shifted alphabet.

How to Recognize Vigenère Ciphertext

Before attempting to break a cipher, it helps to identify whether you are dealing with Vigenère encryption. Several characteristics distinguish Vigenère ciphertext from other cipher types:

  • Letters only, with preserved word boundaries. Like Caesar, Vigenère traditionally encrypts only alphabetic characters, leaving spaces and punctuation intact. Word lengths match the original plaintext.
  • Flattened but not uniform letter frequencies. In a Caesar cipher, the frequency distribution looks like English but shifted. In Vigenère ciphertext, the distribution is significantly flatter — no single letter dominates — but it is not completely uniform either (which would suggest a one-time pad or random text).
  • Index of Coincidence between 0.04 and 0.05. The IC of Vigenère ciphertext typically falls between the English value (~0.067) and the random value (~0.038), depending on key length. An IC in this intermediate range is a strong indicator of polyalphabetic substitution.
  • Repeated sequences at regular intervals. If you spot identical 3+ letter sequences appearing at distances that share a common factor, the text is very likely Vigenère-encrypted (this is the basis of Kasiski analysis).

The Cipher Identifier tool on this site uses these characteristics to automatically detect Vigenère encryption and estimate the key length.

Vigenère Cipher in Python, Java & JavaScript

Implementing the Vigenère cipher is a common exercise in cryptography courses because the core math is only a few lines. These snippets encrypt A–Z letters, preserve case, and pass non-alphabet characters through unchanged.

Python

def vigenere_encrypt(text: str, key: str) -> str:
    key = key.upper()
    out, j = [], 0
    for ch in text:
        if ch.isalpha():
            base = 65 if ch.isupper() else 97
            shift = ord(key[j % len(key)]) - 65
            out.append(chr((ord(ch) - base + shift) % 26 + base))
            j += 1
        else:
            out.append(ch)
    return "".join(out)

Java

static String vigenereEncrypt(String text, String key) {
    key = key.toUpperCase();
    StringBuilder out = new StringBuilder();
    int j = 0;
    for (char ch : text.toCharArray()) {
        if (Character.isLetter(ch)) {
            int base = Character.isUpperCase(ch) ? 'A' : 'a';
            int shift = key.charAt(j % key.length()) - 'A';
            out.append((char) ((ch - base + shift) % 26 + base));
            j++;
        } else {
            out.append(ch);
        }
    }
    return out.toString();
}

JavaScript

function vigenereEncrypt(text, key) {
  key = key.toUpperCase();
  let out = "", j = 0;
  for (const ch of text) {
    if (/[a-zA-Z]/.test(ch)) {
      const base = ch >= "a" ? 97 : 65;
      const shift = key.charCodeAt(j % key.length) - 65;
      out += String.fromCharCode((ch.charCodeAt(0) - base + shift) % 26 + base);
      j++;
    } else {
      out += ch;
    }
  }
  return out;
}

To decrypt, subtract the shift instead of adding it: (ord(ch) - base - shift + 26) % 26 + base.

How to Pronounce "Vigenère"

The cipher is named after Blaise de Vigenère (1523–1596), a French diplomat and cryptographer. The English pronunciation is /ˌviːʒəˈnɛər/ — roughly "vee-zhuh-NAIR", rhyming with "air". The stress falls on the last syllable, and the middle g makes a soft zh sound as in "measure".

The written form carries a grave accent over the second e (è). The accent is often omitted in casual writing and search queries — both "Vigenère cipher" and "Vigenere cipher" refer to the same cipher — but the accented form is the correct spelling.

Where You'll Encounter the Vigenère Cipher

Despite being centuries old, the Vigenère cipher appears frequently in modern contexts:

  • CTF competitions. Cybersecurity Capture The Flag challenges routinely use Vigenère encryption at intermediate difficulty levels. Competitors must identify the cipher type, determine the key length, and recover the key to obtain the flag.
  • Escape rooms and puzzle hunts. Vigenère is a popular choice for multi-step puzzles because it requires both a key and ciphertext, allowing puzzle designers to hide the keyword as a separate clue.
  • Cryptography courses. The Vigenère cipher is the standard example used to teach polyalphabetic substitution, key management, Kasiski analysis, and the Index of Coincidence in university-level cryptography and information security courses.
  • Pop culture. The Vigenère cipher has appeared in the TV series Gravity Falls, the video game Destiny 2, and numerous detective novels. The animated show Gravity Falls famously used Vigenère-encrypted messages in its end credits, with the keyword hidden in each episode.
  • Historical reenactment. Civil War enthusiasts and educational programs use replica Confederate cipher disks to demonstrate period-accurate encryption techniques.

The Vigenère cipher is part of a family of polyalphabetic systems that evolved from the same core idea:

  • Beaufort Cipher — A reciprocal variant where the key letter is subtracted from a fixed position rather than added. Beaufort encryption and decryption use the same operation.
  • Autokey Cipher — Vigenère's own invention: the key starts with a primer and then appends the plaintext itself, eliminating the repeating-key weakness.
  • Gronsfeld Cipher — A Vigenère variant that restricts the key to digits (0–9), reducing the per-position keyspace from 26 to 10.
  • Running Key Cipher — Uses a long passage of text (e.g., a book page) as the key, approaching one-time pad security without requiring a truly random key.
  • Trithemius Cipher — The predecessor that shifts each letter progressively (A=0, B=1, C=2, …) without a secret key. Bellaso's innovation was replacing this fixed progression with a secret keyword.
  • Porta Cipher — A reciprocal digraphic cipher using 13 alphabets, designed as a self-inverse system.
  • Quagmire Cipher — A family of four variants that combine keyword-mixed alphabets with Vigenère-style polyalphabetic shifting.
  • Alberti Cipher — The first polyalphabetic cipher, invented by Leon Battista Alberti in the 1460s using a rotating cipher disk. Alberti's concept of changing alphabets during encryption was the precursor to all subsequent polyalphabetic systems, including Bellaso's keyword method.

The evolution from Alberti's cipher disk (1460s) → Trithemius's progressive shift (1508) → Bellaso's keyword method (1553) → Vigenère's autokey system (1586) represents one of the most important development arcs in the history of cryptography, each step addressing a weakness of the previous design.

Further Reading

Explore Vigenère cipher history, cryptanalysis techniques, and code implementations: