Tools · Classical ciphers
Vigenère cipher: encoder and cracker
Vigenère and Beaufort: encode with a key, or crack without one — key length from the index of coincidence.
Runs in your browser. Your text goes nowhere.
How to use it
Type a key, one word or several, and a text. The result appears as you type. Below it is a tape: above every letter of the text sits the key letter that fell on it, and underneath is what came out. The key only moves on letters: spaces, digits and punctuation stay where they are and don't use up a key letter. Case is kept. The “⇅” button swaps the fields and flips the mode.
The alphabet is detected from the text: Latin (26 letters) or Russian (33, with ё). The key has to be in the same alphabet as the text.
Vigenère, Beaufort and the variant
In the classic Vigenère cipher the number of the key letter is added to the number of the text letter (A = 0, B = 1…): cipher = text + key. Beaufort turns it round: cipher = key − text. That makes Beaufort its own inverse, so encrypting twice with the same key gives back the original. The “variant” subtracts the key from the text: cipher = text − key, which is handy for decrypting someone else's Vigenère. All three are exactly as strong as each other.
How the crack works
When you don't know the key, the “Cracking without the key” panel does what Babbage and Kasiski did in the nineteenth century, only in milliseconds. For every possible key length L the text is split into L columns (letters 1, L+1, 2L+1… are the first column, and so on) and the index of coincidence is measured: the chance that two letters picked at random from a column are the same. Ordinary English scores about 0.067, Russian about 0.055, and a random jumble of letters 0.038 (0.030 for Russian). When L is right, each column is encrypted with a single key letter and its index jumps to the level of the language. Multiples of the length (2L, 3L) score high too, so the tool picks the first length that comes close.
Kasiski's check looks for repeats of three letters or more in the ciphertext. Often they are the same word that happened to meet the key in the same position, so the distance between them is a multiple of the key length.
Each column is then a plain Caesar cipher. The tool tries every shift and keeps the one whose letter frequencies are closest to the language (by χ²). If a key letter comes out wrong, nudge it with the ▲▼ arrows and the decryption updates at once. “Use the key” puts the key in the key field and switches to decryption.
The crack is reliable when the ciphertext has at least 30 to 40 times as many letters as the key. A short note is beyond statistics: you need the key itself, or a good guess.
The Vigenère square
At the bottom is the tabula recta, the table of every shifted alphabet. Click a letter on the tape and the square lights up the key letter's row, the text letter's column and the cell where they cross. For Beaufort and the variant the caption explains the other way of reading the square.
FAQ
How do I decrypt a Vigenère cipher when I know the key?
Choose “Decrypt”, paste the ciphertext and type the key. Case and spaces in the key don't matter.
Can Vigenère be broken without the key?
Yes, if the text is long enough and the key repeats. The Vigenère lesson explains why.
Is it safe to paste my text here?
Yes. Everything runs in your browser and nothing is sent to a server.