Beaufort Cipher
Reciprocal Vigenère variant: encrypt and decrypt are identical.
Overview
The Beaufort cipher tool encrypts and decrypts text using a polyalphabetic substitution where encryption and decryption are the same operation. Type a plaintext (or ciphertext) and a keyword, and the same algorithm flips between the two — there is no separate "decrypt" mode.
It is a teaching tool for understanding classical cryptography, a puzzle aid for cryptograms and escape rooms, and a historical curiosity that powered British naval cipher discs in the late 19th century. If you are working through the Beaufort variant of Vigenère by hand, this is a quick correctness check.
How it works
The Beaufort cipher, named after Sir Francis Beaufort, applies the formula C_i = (K_i - P_i) mod 26 letter by letter, where P_i is the plaintext letter (A=0..Z=25), K_i is the repeating key letter, and C_i is the ciphertext letter. Subtraction is reciprocal: applying the formula again to the ciphertext with the same key recovers the plaintext. Compare with classical Vigenère, which uses C_i = (P_i + K_i) mod 26 and therefore needs a distinct decryption step. Non-letters are passed through unchanged; case is preserved.
Examples
Plaintext: ATTACK AT DAWN
Key: LEMON
Output: LLTMDA LP LRWN
Ciphertext: LLTMDA LP LRWN
Key: LEMON
Output: ATTACK AT DAWN
Plaintext: HELLO
Key: KEY
Output: DAN VK
Plaintext: BEAUFORT
Key: SAILOR
Output: RWIORZ ME (key cycles SAILOR SA)
FAQ
Is Beaufort secure?
No. It is a 19th-century cipher and falls to the same Kasiski examination and frequency analysis used to break Vigenère. Treat it as a teaching exercise, not a real cipher.
Why is encryption the same as decryption?
Because K - (K - P) = P modulo 26. The Beaufort transformation is its own inverse, which is why classic Beaufort discs only need one operation.
What is the German "Beaufort-Variante"?
That is the autokey Beaufort variant, where the key is extended with the plaintext (or ciphertext) once the keyword runs out. This tool uses the simpler repeating-key form.
Does it handle spaces and punctuation?
Yes — non-letter characters pass through unchanged so the output reads at the same word boundaries as the input.