Vigenère Cipher
Encrypt and decrypt text with the Vigenère cipher and explore classical ciphers.
About this tool
A full classical cipher toolkit featuring the Vigenère cipher with interactive tableau, Caesar cipher (shift 1–25), ROT13, and Atbash. The Vigenère mode visualises the 26×26 square, highlights active key letters, and shows a step-by-step encoding table. A built-in 'Crack It' frequency analysis tool gives hints for breaking unknown Vigenère keys.
How to use
- 1 Step 1: Select a cipher mode tab: Vigenère, Caesar, ROT13, or Atbash.
- 2 Step 2: Enter your plaintext (or ciphertext) and — for Vigenère/Caesar — provide the keyword or shift value.
- 3 Step 3: Click Encrypt or Decrypt. The result appears immediately along with a step-by-step character table.
- 4 Step 4: For Vigenère, use the 'Crack It' tab to run frequency analysis and compare letter distribution against expected English frequencies.
The idea that makes Vigenère stronger than Caesar
A Caesar cipher shifts every letter by the same fixed amount, so the letter E always becomes the same ciphertext letter. That single, constant shift is its fatal weakness: count the letters and the most common one is almost certainly E in disguise. The Vigenère cipher defeats this by using a repeating keyword so that each position is shifted by a different amount. It is a polyalphabetic cipher — it uses many shift alphabets instead of one — which is why the same plaintext letter can encrypt to several different ciphertext letters depending on where it sits.
How the keyword drives the shifts
Write your keyword repeatedly above the message, one key letter per plaintext letter. Each key letter selects a shift: A shifts by 0, B by 1, C by 2, and so on up to Z by 25. To encrypt, add the key letter's shift to the plaintext letter (wrapping around past Z back to A). To decrypt, subtract it. Crucially, the key index advances only on alphabetic characters — spaces, digits, and punctuation pass through untouched and do not consume a key letter, and letter case is preserved. This tool visualizes the whole process with the classic 26×26 tableau (the Vigenère square), highlighting the columns that belong to your key, and prints a step-by-step table of the first 40 letters showing plaintext, key letter, shift, and result.
A worked example
Encrypt HELLO with the keyword KEY. The repeating key is K E Y K E, giving shifts 10, 4, 24, 10, 4:
H(7) + 10 = 17 → RE(4) + 4 = 8 → IL(11) + 24 = 35 mod 26 = 9 → JL(11) + 10 = 21 → VO(14) + 4 = 18 → S
So HELLO becomes RIJVS. Notice the two Ls encrypted to different letters (J and V) because they fell under different key letters — exactly the property that hides the frequency fingerprint a Caesar cipher leaves behind.
The three companion ciphers
- Caesar: a single fixed shift from 1 to 25. Simple, and its own family of 25 possible keys makes it trivially breakable by trying them all.
- ROT13: a Caesar cipher locked to a shift of 13. Because 13 is exactly half of 26, applying it twice returns the original — it is its own inverse, which is why it is used to lightly hide spoilers, not to secure anything.
- Atbash: mirrors the alphabet so
A↔Z,B↔Y, and so on. It needs no key and is also self-inverse.
How the "Crack It" analysis works
For centuries Vigenère was called le chiffre indéchiffrable ("the undecipherable cipher") until cryptanalysts learned to attack the key length. The Crack It tab gives you the two classic tools. First, a letter-frequency chart overlays your ciphertext's observed letter distribution against expected English frequencies; when a guessed key length is correct, slicing the text into columns makes each column's distribution start to resemble English. Second, it computes the Index of Coincidence (IC) — the probability that two randomly chosen letters match. English text has an IC near 0.065; uniformly random text sits near 0.038. A high IC points to a monoalphabetic cipher (Caesar or a very short key); a low IC signals a longer polyalphabetic key. The tool reports the value and a plain-language hint to steer your next guess.
Practical tips and honest limits
- Longer, word-free keys are stronger. A key as long as the message, never reused, is the unbreakable one-time pad. A short dictionary word is the easiest to crack.
- Mind what survives. Spaces and punctuation are preserved and can leak word lengths. For tougher puzzles, strip spaces and group the output into fixed blocks of five.
- It is a learning toy, not security. Vigenère has been breakable since the 19th century. Use it for puzzles, escape rooms, classroom demonstrations, and CTF challenges — never to protect real secrets, for which you should use modern encryption.