TL;DR: Beaufort cipher formula
Beaufort encrypts with C = (K − P) mod 26 and decrypts with P = (K − C) mod 26. Number letters A = 0 through Z = 25: P is the plaintext value, K is the key value, and C is the ciphertext value. Repeat the keyword over letters. Modulo 26 wraps a negative result into 0–25; for example, −1 becomes 25 (Z).
Beaufort is reciprocal because K − (K − P) ≡ P (mod 26). With keyword KEY, HELLO becomes DANZQ; applying Beaufort again gives HELLO. This is the subtraction direction documented by the American Cryptogram Association (ACA).
How to decrypt Beaufort
- Choose Beaufort and paste the ciphertext. Use the standard reciprocal option for a repeating-key Beaufort message.
- Enter the original keyword. Align its first letter with the first ciphertext letter, repeat it as needed, and skip spaces and punctuation.
- Read the live result under Apply Beaufort. Each letter uses P = (K − C) mod 26. Check
DANZQwithKEY: it must decode toHELLO. Copy or download the result.
For Variant Beaufort or plaintext autokey, choose that cipher and Decode. A wrong keyword can still produce letters; meaningful text depends on the correct key, cipher and alignment. Without a key, start with the key-length demonstration below.
Worked example: HELLO → DANZQ → HELLO
The keyword KEY expands to KEYKE. Each cell below is computed from the letter values; the reverse table uses the same key and subtraction.
| P | K | K − P mod 26 | C |
|---|---|---|---|
| H (7) | K (10) | (10 − 7) mod 26 = 3 | D |
| E (4) | E (4) | (4 − 4) mod 26 = 0 | A |
| L (11) | Y (24) | (24 − 11) mod 26 = 13 | N |
| L (11) | K (10) | (10 − 11) mod 26 = 25 | Z |
| O (14) | E (4) | (4 − 14) mod 26 = 16 | Q |
| C | K | K − C mod 26 | P |
|---|---|---|---|
| D (3) | K (10) | (10 − 3) mod 26 = 7 | H |
| A (0) | E (4) | (4 − 0) mod 26 = 4 | E |
| N (13) | Y (24) | (24 − 13) mod 26 = 11 | L |
| Z (25) | K (10) | (10 − 25) mod 26 = 11 | L |
| Q (16) | E (4) | (4 − 16) mod 26 = 14 | O |
Beaufort vs Vigenère vs Variant Beaufort
Use A = 0…Z = 25 and the same repeated key. Every formula in this table is modulo 26.
| Cipher | Encrypt C | Decrypt P | Same operation? |
|---|---|---|---|
| Beaufort | K − P | K − C | Yes |
| Variant Beaufort | P − K | C + K | No, in general |
| Vigenère | P + K | C − K | No, in general |
ACA’s Variant definition is exactly the operation used for Vigenère decryption. Compare it directly in the Vigenère tool. Variant Beaufort is not the reciprocal Beaufort cipher: subtracting a key twice generally does not restore the input.
Same 12 sentences, same key: LEMON
Variant Beaufort equals Vigenère decryption on 12/12 sentences. Beaufort applied twice restores 12/12 sentences. We use the same twelve traditional public-domain proverbs as the cipher identifier, retaining case and punctuation. Each run starts the key at its first letter.
For this comparison, “Vigenère decrypt” takes the original sentence as its input, just as Variant Beaufort encode does. These are checks of mathematical identities with a known key, not success rates for breaking unknown messages.
See all 12 sentences and outputs
1. A stitch in time saves nine.
- Beaufort
- L mtgujx eb udsi wnqau bfya.
- Variant Beaufort
- P ohugrd wz gxis enkag zvca.
- Vigenère encode
- L wfwgnl ub gtqq gngie bvyi.
- Vigenère decrypt
- P ohugrd wz gxis enkag zvca.
- Beaufort twice
- A stitch in time saves nine.
- Both checks
- Pass
2. Actions speak louder than words.
- Beaufort
- Lctgzym uzjlu batiav vglr qawim.
- Variant Beaufort
- Pyhubco gbrpg zahsaf fupj kaeso.
- Vigenère encode
- Lgfwbyw edrlo xchoid hulr iceow.
- Vigenère decrypt
- Pyhubco gbrpg zahsaf fupj kaeso.
- Beaufort twice
- Actions speak louder than words.
- Both checks
- Pass
3. All that glitters is not gold.
- Beaufort
- Ltb vgll gdfslixv dm zau fqbl.
- Variant Beaufort
- Phz fupp uxvipsdf xo bag vkzp.
- Vigenère encode
- Lpx hulx szvexqff tw zcg rsxr.
- Vigenère decrypt
- Phz fupp uxvipsdf xo bag vkzp.
- Beaufort twice
- All that glitters is not gold.
- Both checks
- Pass
4. Better late than never.
- Beaufort
- Katvju tmvj sxmb ahjix.
- Variant Beaufort
- Qahfrg hofr idoz atrsd.
- Vigenère encode
- Mifhrc pmhr elmb apzqf.
- Vigenère decrypt
- Qahfrg hofr idoz atrsd.
- Beaufort twice
- Better late than never.
- Both checks
- Pass
5. Birds of a feather flock together.
- Beaufort
- Kwvlv xz m jjllfkw gtymd sqgkueav.
- Variant Beaufort
- Qefpf db o rrppvqe uhcox ikuqgwaf.
- Vigenère encode
- Mmdrf zj m trlxtse qpaqx esssgsid.
- Vigenère decrypt
- Qefpf db o rrppvqe uhcox ikuqgwaf.
- Beaufort twice
- Birds of a feather flock together.
- Both checks
- Pass
6. Every cloud has a silver lining.
- Beaufort
- Hjixp jtyuk eeu o vdtrkw awzgaf.
- Variant Beaufort
- Trsdl rhcgq wwg m fxhjqe aebuav.
- Vigenère encode
- Pzqfl npaiq see o ftphse wmzwar.
- Vigenère decrypt
- Trsdl rhcgq wwg m fxhjqe aebuav.
- Beaufort twice
- Every cloud has a silver lining.
- Both checks
- Pass
7. Fortune favors the bold.
- Beaufort
- Gqvvtya hosxnu vgh dydk.
- Variant Beaufort
- Ukffhca tmidng fut xcxq.
- Vigenère encode
- Qsdhhyi roizve hup fazq.
- Vigenère decrypt
- Ukffhca tmidng fut xcxq.
- Beaufort twice
- Fortune favors the bold.
- Both checks
- Pass
8. Look before you leap.
- Beaufort
- Aqye mhzyxj nqs djlp.
- Variant Beaufort
- Akcw otbcdr nki xrpl.
- Vigenère encode
- Wsay opjafr jsg zrlt.
- Vigenère decrypt
- Akcw otbcdr nki xrpl.
- Beaufort twice
- Look before you leap.
- Both checks
- Pass
9. Necessity is the mother of invention.
- Beaufort
- Yakkvtwtq ft lfk bxlfkw xz ebshrtgzy.
- Variant Beaufort
- Caqqfhehk vh pvq zdpvqe db wzitjhubc.
- Vigenère encode
- Yiosfdmfm vd xts zzxtse zj ubiprfwby.
- Vigenère decrypt
- Caqqfhehk vh pvq zdpvqe db wzitjhubc.
- Beaufort twice
- Necessity is the mother of invention.
- Both checks
- Pass
10. Practice makes perfect.
- Beaufort
- Wnmmudci cnbau zjuzimu.
- Variant Beaufort
- Enoogxys ynzag brgbsog.
- Vigenère encode
- Avmqgtgq anvie drcjqqg.
- Vigenère decrypt
- Enoogxys ynzag brgbsog.
- Beaufort twice
- Practice makes perfect.
- Both checks
- Pass
11. The early bird catches the worm.
- Beaufort
- Sxi knuto nfub koujxiw uea qawz.
- Variant Beaufort
- Ids qnghm nvgz qmgrdse gwa kaeb.
- Vigenère encode
- Elq sncpk pvch oognlqg gsi icex.
- Vigenère decrypt
- Ids qnghm nvgz qmgrdse gwa kaeb.
- Beaufort twice
- The early bird catches the worm.
- Both checks
- Pass
12. Where there is a will, there is a way.
- Beaufort
- Pxixj sxixj dm m sfat, thjua ew n peo.
- Variant Beaufort
- Ldsdr idsdr xo o ivah, htrga we n lwm.
- Vigenère encode
- Hlqfr elqfr tw m kvwp, fvrci ug n hek.
- Vigenère decrypt
- Ldsdr idsdr xo o ivah, htrga we n lwm.
- Beaufort twice
- Where there is a will, there is a way.
- Both checks
- Pass
Download the calculations and full outputs (JSON), including the worked example and key-length demonstration.
Estimating a Beaufort key length with the index of coincidence
A repeating-key Beaufort message leaks the same kind of period clues as Vigenère. Once the period is known, each column is a fixed substitution and preserves letter-count coincidences. For Beaufort, score candidate plaintext with K − C, instead of Vigenère’s C − K. Crypto Museum explains the repeated-key weakness and Kasiski/Friedman methods.
This example encrypts the Gettysburg Address, Bliss copy (1863): 1,149 A–Z letters, keyword LINCOLN, known period 7. For each candidate length, split the ciphertext into interleaved columns, compute IoC = Σ f(f − 1) / [n(n − 1)], then average the column values without weighting. Here f is a letter count and n is the column length.
| Key length | Mean IoC | Relation to known key |
|---|---|---|
| 1 | 0.0446 | Other candidate |
| 2 | 0.0446 | Other candidate |
| 3 | 0.0441 | Other candidate |
| 4 | 0.0442 | Other candidate |
| 5 | 0.0446 | Other candidate |
| 6 | 0.0449 | Other candidate |
| 7 | 0.0717 | True period |
| 8 | 0.0440 | Other candidate |
| 9 | 0.0439 | Other candidate |
| 10 | 0.0443 | Other candidate |
| 11 | 0.0448 | Other candidate |
| 12 | 0.0440 | Other candidate |
| 13 | 0.0442 | Other candidate |
| 14 | 0.0718 | Multiple of true period |
The true length 7 gives 0.0717, while length 14 gives 0.0718 and ranks slightly higher. A multiple can peak too: test the shorter divisor instead of assuming the largest IoC proves the key length. With Vigenère and the same passage/key, the mean at length 7 is also 0.0717, because fixed alphabet permutations preserve coincidences within each column.
Use the Kasiski walkthrough to find repeated-sequence gaps and the frequency analysis tool to inspect letter counts. Short messages and atypical text give less reliable clues. This demonstration estimates repeating-key periods; it does not directly estimate a plaintext-autokey primer.
Read the full normalized passage and Beaufort ciphertext
Uppercase A–Z only; spaces and punctuation removed before encryption. Keyword: LINCOLN.
Plaintext
FOURSCOREANDSEVENYEARSAGOOURFATHERSBROUGHTFORTHONTHISCONTINENTANEWNATIONCONCEIVEDINLIBERTYANDDEDICATEDTOTHEPROPOSITIONTHATALLMENARECREATEDEQUALNOWWEAREENGAGEDINAGREATCIVILWARTESTINGWHETHERTHATNATIONORANYNATIONSOCONCEIVEDANDSODEDICATEDCANLONGENDUREWEAREMETONAGREATBATTLEFIELDOFTHATWARWEHAVECOMETODEDICATEAPORTIONOFTHATFIELDASAFINALRESTINGPLACEFORTHOSEWHOHEREGAVETHEIRLIVESTHATTHATNATIONMIGHTLIVEITISALTOGETHERFITTINGANDPROPERTHATWESHOULDDOTHISBUTINALARGERSENSEWECANNOTDEDICATEWECANNOTCONSECRATEWECANNOTHALLOWTHISGROUNDTHEBRAVEMENLIVINGANDDEADWHOSTRUGGLEDHEREHAVECONSECRATEDITFARABOVEOURPOORPOWERTOADDORDETRACTTHEWORLDWILLLITTLENOTENORLONGREMEMBERWHATWESAYHEREBUTITCANNEVERFORGETWHATTHEYDIDHEREITISFORUSTHELIVINGRATHERTOBEDEDICATEDHERETOTHEUNFINISHEDWORKWHICHTHEYWHOFOUGHTHEREHAVETHUSFARSONOBLYADVANCEDITISRATHERFORUSTOBEHEREDEDICATEDTOTHEGREATTASKREMAININGBEFOREUSTHATFROMTHESEHONOREDDEADWETAKEINCREASEDDEVOTIONTOTHATCAUSEFORWHICHTHEYGAVETHELASTFULL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BZPAUJIFJCLPJSIDYGYLUENKKIKHNZJGXASUUVOSLLOVYJXWPBFAHSGHKHCTHUEECCWSIRXCQKLVRRJOJIJQUUUAYUEIUGKEJUEGUIECNRJKAASHPGCVSGHQJZKLKTBNRDYZSBNHKIFHFFPTLFYPGCVSGDQACVDZYOAZKUHXFVVOACEISYOYJPHFLVEZGDWYKIZZIAZVENSCZHKUAZEAJAGUEEYYAWCHHPJHHYHUYRKGZUPGYZHZWXJKHLCAVZJZHWDQGXXXBSBJYOUUE
What changes with Beaufort autokey?
Plaintext autokey uses a primer followed by the message’s plaintext letters. With primer KEY and plaintext HELLO, the key stream begins KEYHE, giving DANWQ. Decode reconstructs H and E before using them later in the key. The subtraction is still K − input, but applying Encode twice with the same primer does not generally recover the message.
The ACA autokey sheet describes this plaintext extension and its use with Beaufort, Variant and Vigenère. Its printed example uses Vigenère: our checks reproduce that vector, then derive a Beaufort result from its published key stream. This tool’s autokey option uses plaintext feedback. For the additive version, open the autokey cipher tool; a running-key cipher instead uses an external text as its key stream.
A short history of Beaufort
Sir Francis Beaufort (1774–1857) was a Royal Navy officer and hydrographer. He became hydrographer to the navy in 1829 and served in that role for 26 years, as recorded in the Dictionary of National Biography’s account of his career.
The cipher bearing his name belongs to the polyalphabetic family: a keyword selects a different substitution at each position. Its distinctive arithmetic is the reciprocal K − P rule, documented with a worked Beaufort example by the ACA. It remains useful for learning and puzzles; repeated-key classical ciphers do not provide modern confidentiality.
Frequently asked questions
What is the variant Beaufort cipher?
Variant Beaufort encrypts with C = (P − K) mod 26, using A = 0 through Z = 25. Its encryption is the same operation as Vigenère decryption. To decrypt Variant Beaufort, add the key: P = (C + K) mod 26. Unlike standard Beaufort, it is not generally reciprocal.
Is Beaufort the same as Vigenère?
They are related polyalphabetic ciphers, but their formulas differ. Beaufort uses C = (K − P) mod 26; Vigenère uses C = (P + K) mod 26. Beaufort uses the same subtraction for encryption and decryption. Both repeating-key versions expose key-period patterns that can be studied with Kasiski examination and the index of coincidence.
How do I decrypt a Beaufort cipher?
Select Beaufort, paste the ciphertext, and enter the original keyword. Apply Beaufort computes P = (K − C) mod 26 automatically. For example, DANZQ with KEY becomes HELLO. Only A–Z letters advance the key; case and punctuation are preserved by default. For Variant Beaufort or plaintext autokey, select the matching option and Decode.