Encrypt and decrypt messages using the classic polyalphabetic substitution cipher.Enter your text and a keyword, then encrypt or decrypt instantly. Preserves case and non‑alphabetic characters. Fully client‑side and zero‑knowledge — your secrets stay private.
The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven Caesar ciphers based on the letters of a keyword. It is a form of polyalphabetic substitution, first described by Giovan Battista Bellaso in 1553, but later misattributed to Blaise de Vigenère in the 19th century. For over three centuries, it was considered le chiffre indéchiffrable (the unbreakable cipher) until Friedrich Kasiski published a complete cryptanalysis in 1863.
Encryption: Ci = (Pi + Ki) mod 26 | Decryption: Pi = (Ci - Ki) mod 26
Where A=0, B=1, … , Z=25. The key repeats cyclically to match the plaintext length.
Unlike the simple Caesar cipher (shift fixed by 3), Vigenère uses a keyword to determine different shifts for each character, making frequency analysis much harder. It resists brute force because the key length adds entropy, but modern cryptanalysis (Kasiski examination and index of coincidence) can break it when the key is short or repeated.
| # | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|
The tableau illustrates how each key letter shifts the plaintext letter. Row = key letter, Column = plaintext letter gives ciphertext letter.
Though obsolete for military use after WWI, the Vigenère cipher remains a cornerstone of classical cryptography education. It is widely used in puzzle competitions (Crypto challenges, Capture The Flag), escape rooms, and as an introduction to polyalphabetic ciphers. The concept of a repeating key inspired modern stream ciphers (like RC4) and is foundational to understanding the importance of key randomness and length. Historical use: Confederate forces during the American Civil War relied on a Vigenère variant.
In 1863, Friedrich Kasiski published a method to determine the key length by detecting repeated sequences in the ciphertext. For example, if the plaintext contains identical trigrams separated by a distance that is a multiple of the key length, the ciphertext will also show repetitions. Our tool allows you to experiment: encrypt long English text with a short key (e.g., "FOO") and observe patterns. This demonstrates why modern ciphers require unpredictable, key‑length keystreams (e.g., OTP).
| Cipher | Type | Key Flexibility | Vulnerability | Best Use |
|---|---|---|---|---|
| Caesar Cipher | Monoalphabetic | Fixed shift (1–25) | Brute force, frequency | Basic puzzles |
| Vigenère Cipher | Polyalphabetic | Keyword (variable length) | Kasiski / index of coincidence if key short | Education, CTF beginner |
| One-Time Pad | Perfect secrecy | Truly random, ≥ message length | Key distribution | Theoretical & high‑security |
Let the alphabet be indexed 0–25. For encryption: For each character position i, let p = plaintext letter index, k = key letter index (key cycled). Ciphertext index c = (p + k) mod 26. Decryption: p = (c - k + 26) mod 26. Our implementation respects letter case: "A/a" shift uses separate case tracking. Non‑alphabetic characters are copied directly, which makes the tool suitable for encrypting natural language sentences without losing structure.
Because JavaScript uses Unicode, we filter only A-Z/a-z and map them consistently. Key normalization converts all letters to uppercase for shift arithmetic, case is only applied on output.