What Is the Beaufort Cipher?
The Beaufort cipher is a polyalphabetic substitution cipher — one of the family that also includes the Vigenère and the similar Autokey system — invented by Sir Francis Beaufort and published posthumously in 1857, the year he died. Where the Vigenère cipher encrypts each letter by adding the key letter to it, the Beaufort cipher subtracts the plaintext from the key: C = (K − P) mod 26. Since subtracting C back out of K recovers P, the same formula works in both directions. This self-inverse property makes it a reciprocal cipher, which historically mattered a great deal: a reciprocal transformation means one table, one disk, or one machine setting handles both enciphering and deciphering, halving the risk of operator error.
The man behind the name is better remembered for the Beaufort wind-force scale, the 0–12 scale sailors still use to describe sea conditions. The cipher shares his name because he devised it near the end of his life, and his brother William published the details in 1857, shortly after Beaufort's death, as a small card titled "Cryptography, A System of Secret Writing."
How the Beaufort Cipher Works
Assign each letter a number: A = 0, B = 1, …, Z = 25. With a key letter of value K and a plaintext letter of value P, the ciphertext letter is C = (K − P) mod 26. "Mod 26" means the result wraps around the alphabet, so a negative difference like −3 becomes 23 (X). The key letter is drawn from the keyword in sequence and repeats cyclically; non-letter characters in the message pass through unchanged and do not advance the key.
| Key letter K | Plain P | K − P | Cipher C |
|---|---|---|---|
| K (10) | H (7) | 3 | D |
| E (4) | E (4) | 0 | A |
| Y (24) | L (11) | 13 | N |
| K (10) | L (11) | −1 → 25 | Z |
| E (4) | O (14) | −10 → 16 | Q |
Step-by-Step Example
Encrypt the word "HELLO" with the key "KEY". Write the key letters underneath the message and subtract, position by position:
Plain: H E L L O
Key: K E Y K E
Cipher: D A N Z Q
Reading the bottom row gives DANZQ. Now decrypt DANZQ with the same key: D (3) against K (10) gives 10 − 3 = 7, the letter H — and each position recovers the original, so the ciphertext returns to HELLO. Type either word into the tool above to watch the correspondence live.
Example Reference Table
| Plain Text | Key | Ciphertext |
|---|---|---|
| HELLO | KEY | DANZQ |
| ATTACK AT DAWN | LEMON | LLTOLB ET LNPR |
| Hello, World! | KEY | Danzq, Cwnnh! |
| SimplyCalculated | TEAL | BwowigYlicgatlwi |
| We attack at dawn | KEY | Oa yrlyiu yr byor |
Paste any plain-text row with its key into the tool to confirm the ciphertext, or paste the ciphertext with the same key to confirm it decodes back — the symmetry of the cipher means either direction passes through the same function.
Security and Cryptanalysis
The Beaufort cipher offers no real security by modern standards, and for exactly the same reason the Vigenère cipher doesn't: it is a periodic polyalphabetic substitution. Because the key repeats every few letters, the ciphertext contains statistical fingerprints of the key length. Friedrich Kasiski's 1863 examination finds repeated ciphertext digraphs and measures the distances between them, whose common factor reveals the key period; once the period is known, every key letter stands alone as a simple Caesar-style substitution that frequency analysis cracks easily. The key space — a keyword, so at most a few hundred thousand possibilities in practice — adds no real strength. Its historical value lay in its convenience: reciprocal, compact, and cheap to use by hand. For actual secrecy today, use a modern algorithm; this tool exists for learning, puzzles, and curiosity.
Troubleshooting & Common Mistakes
My decrypted output looks nothing like my original message
The key must match exactly — case is ignored and only letters count, so "LEMON" and "lemon" are identical, but "LEMONS" is a different key. Double-check the key and confirm the ciphertext was copied completely; a single missing character shifts every key letter after it.
My output matches my input exactly
An empty key (no letters A–Z) makes the cipher the identity transformation — everything passes through unchanged. Type a real keyword and the text will scramble.
I entered a key with digits or symbols — is that a problem?
No. Only the letters in the key are used; "k3y!" and "KEY" produce identical output. The same is true in the message: spaces, punctuation, and digits ride along unchanged and never consume a key letter.
How This Cipher Compares to Other Classical Ciphers
Beaufort is one of several classical ciphers covered on this site. It is a close relative of Vigenère — built on the same polyalphabetic keyword idea — but its self-reciprocal operation sets it apart from every other cipher in the table below.
| Cipher | Mechanism | What Makes It Different |
|---|---|---|
| Caesar Cipher | Substitution | Shifts every letter by one fixed number (the key) through the alphabet — the simplest classical substitution cipher. |
| Atbash Cipher | Substitution (fixed) | A special case of substitution with no key at all — it always mirrors the alphabet (A↔Z, B↔Y, ...). |
| Vigenère Cipher | Polyalphabetic substitution | Repeats a keyword to shift each letter by a different amount, defeating simple frequency analysis that breaks Caesar. |
| Beaufort Cipher (this page) | Polyalphabetic substitution (reciprocal) | A variant of Vigenère's idea that is self-reciprocal — the same operation both encrypts and decrypts. |
| Playfair Cipher | Digraph substitution | Encrypts letters two at a time using their positions in a 5×5 key square — the first practical digraph cipher (1854). |
| Affine Cipher | Mathematical substitution | Encrypts using a linear function (ax + b mod 26) with two keys instead of one shift value. |
| ROT47 | Substitution (extended range) | Applies a Caesar-style shift across the full printable ASCII range, not just letters — used to obfuscate text online (e.g. spoilers), not for security. |
| Rail Fence Cipher | Transposition | Rearranges letter order in a zigzag pattern instead of substituting letters — a fundamentally different technique from every cipher above. |
| A1Z26 | Encoding (not a cipher) | Simply maps each letter to its position number (A=1...Z=26) — a puzzle/encoding convention, not intended for real secrecy. |
| NATO Phonetic Alphabet | Encoding (not a cipher) | Replaces each letter with a spoken code word (Alfa, Bravo, Charlie…) for reliable voice transmission on noisy radios — built for clarity, not secrecy. |