How to use the autokey Vigenère tool
- Choose the Direction: Encrypt or Decrypt.
- Enter the Primer keyword. Only its letters count; the default is QUEENLY.
- Type into Your text.
- Copy the Result. To decrypt, use the same primer and switch the direction.
What it does and when to use it
The autokey cipher was described by Blaise de Vigenère in the 1500s, and it is the version he actually proposed; the repeating-key cipher that carries his name today is simpler. The idea is to stop the key from repeating by feeding the message back into it. That defeats the classic attack on the Vigenère cipher, which looks for repeated patterns spaced by the key length.
Use it for puzzles, geocaches and cryptography lessons, especially to show how a small change to a cipher can block one attack and open another. It is not suitable for protecting real information. Related tools: the Beaufort cipher reverses the arithmetic, and the Gronsfeld cipher uses a digit key.
How it works
Number the letters A = 0 to Z = 25. The key stream starts with the primer letters. For each letter of the message:
Encrypt: C = (P + K) mod 26, then add P to the end of the key stream
Decrypt: P = (C − K) mod 26, then add P to the end of the key stream
In both directions the plain letter is added, which is why the receiver, who recovers the plain text letter by letter, can rebuild the same key stream.
The textbook example lines up like this:
Plain: A T T A C K A T D A W N
Key: Q U E E N L Y A T T A C
Cipher: Q N X E P V Y T W T W P
Only A to Z and a to z are changed, and each keeps its case. Other characters are copied across and never enter the key stream. The tool runs in your browser.
Worked examples
Results from the tool:
ATTACKATDAWN primer QUEENLY → QNXEPVYTWTWP
Meet me at 9, by the gate! primer Key → Wicf qi tf 9, fy mic zhxk!
Wicf qi tf 9, fy mic zhxk! primer Key, Decrypt → Meet me at 9, by the gate!
Hi primer 7 → The key needs at least one letter.
Compare the second line with ordinary Vigenère and the key KEY: both start “Wic”, because the first three letters use the primer, but from the fourth letter on autokey uses “meetmeat…” as its key and the results part ways.
Limits and tips
- A longer primer hides more of the message start, which is where guessing attacks begin.
- Because spaces are kept, word lengths show. Remove spaces first if that matters.
- Accented letters are not encrypted and do not join the key stream.
Frequently asked questions
What is the primer?
Why is autokey stronger than ordinary Vigenère?
Why does one wrong letter spoil the rest of my decryption?
What happens to spaces, digits and punctuation?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.