Skip to content

Beaufort Cipher

Type a message and a keyword to encode or decode it with the Beaufort cipher — or its variant, which is the Vigenère cipher run backwards. The tool shows the Beaufort square and the sum behind each letter, so you can check the result by hand. Free, no sign-up, and nothing leaves your browser.

Mode

Letters only. The keyword repeats along the message, one key letter for each letter of text.

Version

The classic Beaufort is reciprocal: the same steps encode and decode. The variant is the Vigenère cipher run backwards, so decoding adds the key back.

Keep in the result

Working

  • Letters are numbered A = 0, B = 1 … Z = 25, and every sum wraps around at 26.
  • Encoding: cipher letter = key letter − plain letter.

Beaufort square

ABCDEFGHIJKLMNOPQRSTUVWXYZ
AAZYXWVUTSRQPONMLKJIHGFEDCB
BBAZYXWVUTSRQPONMLKJIHGFEDC
CCBAZYXWVUTSRQPONMLKJIHGFED
DDCBAZYXWVUTSRQPONMLKJIHGFE
EEDCBAZYXWVUTSRQPONMLKJIHGF
FFEDCBAZYXWVUTSRQPONMLKJIHG
GGFEDCBAZYXWVUTSRQPONMLKJIH
HHGFEDCBAZYXWVUTSRQPONMLKJI
IIHGFEDCBAZYXWVUTSRQPONMLKJ
JJIHGFEDCBAZYXWVUTSRQPONMLK
KKJIHGFEDCBAZYXWVUTSRQPONML
LLKJIHGFEDCBAZYXWVUTSRQPONM
MMLKJIHGFEDCBAZYXWVUTSRQPON
NNMLKJIHGFEDCBAZYXWVUTSRQPO
OONMLKJIHGFEDCBAZYXWVUTSRQP
PPONMLKJIHGFEDCBAZYXWVUTSRQ
QQPONMLKJIHGFEDCBAZYXWVUTSR
RRQPONMLKJIHGFEDCBAZYXWVUTS
SSRQPONMLKJIHGFEDCBAZYXWVUT
TTSRQPONMLKJIHGFEDCBAZYXWVU
UUTSRQPONMLKJIHGFEDCBAZYXWV
VVUTSRQPONMLKJIHGFEDCBAZYXW
WWVUTSRQPONMLKJIHGFEDCBAZYX
XXWVUTSRQPONMLKJIHGFEDCBAZY
YYXWVUTSRQPONMLKJIHGFEDCBAZ
ZZYXWVUTSRQPONMLKJIHGFEDCBA

Row = key letter, column = plain letter, cell = cipher letter. Select a letter below to light it up: its row and column turn blue and the cell where they meet turns amber.

Plain letterKey letterArithmeticCipher letter
F5 − 3 = 2C
O14 − 4 = 10K
R17 − 5 = 12M
T19 − 4 = 15P
F5 − 13 = −8 ≡ 18S
O14 − 3 = 11L
R17 − 19 = −2 ≡ 24Y
T19 − 7 = 12M
F5 − 4 = 1B
O14 − 4 = 10K
R17 − 0 = 17R
T19 − 18 = 1B
F5 − 19 = −14 ≡ 12M
O14 − 22 = −8 ≡ 18S
R17 − 0 = 17R
T19 − 11 = 8I
F5 − 11 = −6 ≡ 20U
O14 − 14 = 0A
R17 − 5 = 12M
T19 − 19 = 0A

Showing the first 20 letters.

How to Use the Beaufort Cipher Tool

  1. 1. Pick a version. Classic Beaufort subtracts the plain letter from the key letter. The variant subtracts the key letter from the plain letter. Sender and receiver must use the same one.
  2. 2. Enter a keyword. Only its letters count. The keyword repeats along your message, advancing one key letter for every letter of text.
  3. 3. Type or paste the message. Choose Encode for plain text or Decode for cipher text. Spaces, digits and punctuation pass through unchanged and do not use up key letters.
  4. 4. Read the working. Select any letter in the working table to light up its row, column and result in the square.

How the Beaufort Cipher Works

The Beaufort cipher is a polyalphabetic substitution cipher built on the same 26 × 26 table as the Vigenère cipher. Number the letters A = 0 to Z = 25. For each letter of the message, take the next letter of the repeating keyword, K, and the message letter, P, and compute C = K − P (mod 26). In the Vigenère cipher the key is added to the plain letter; here the plain letter is subtracted from the key.

That one change makes the cipher reciprocal. Because P = K − C is the same subtraction, you decode a Beaufort message by encoding it again with the same keyword — there is no separate decryption routine, which is why it suited a hand cipher or a machine with a single setting. By hand you find the plain letter along the top of the square, run down to the key letter, and read the cipher letter at the head of that column's row.

The variant Beaufort

The variant Beaufort uses C = P − K. That is exactly Vigenère decipherment, so a variant Beaufort message can be read with any Vigenère tool by choosing decode. The variant is not reciprocal: to decode it you add the key back, P = C + K. Puzzle books and the American Cryptogram Association list the two as separate cipher types, which is why this tool offers both.

Worked Example

Encode DEFEND THE EAST WALL with the keyword FORT. The key letters are F = 5, O = 14, R = 17 and T = 19, repeating. The tool's output matches the example published on ciphersonline.com, and you can check each step against the working table.

PlainKeySumCipher
D (3)F (5)5 − 3 = 2C
E (4)O (14)14 − 4 = 10K
F (5)R (17)17 − 5 = 12M
E (4)T (19)19 − 4 = 15P
N (13)F (5)5 − 13 = −8 ≡ 18S

The full message becomes CKMPSL YMB KRBM SRIU. Feed that back in with the same key and Beaufort returns DEFEND THE EAST WALL. Notice that the first E and the second E encipher to K and P — one plain letter, several cipher letters — which is what stops simple letter counting from breaking the message.

Who Invented the Beaufort Cipher?

The cipher is named after Sir Francis Beaufort (1774–1857), the Irish-born Royal Navy officer and hydrographer best known for the wind-force scale that also bears his name. Its roots go back further: the idea of a repeating key selecting a different alphabet for each letter was set out by Giovan Battista Bellaso in 1553 and popularised by Blaise de Vigenère in 1586, and the Beaufort cipher is that scheme with the subtraction reversed. A description of the system was published in 1857, the year Beaufort died. Its best-known later use was inside a machine: the Hagelin M-209, the US Army's Second World War field cipher device, performs a Beaufort-type substitution with a key that does not simply repeat.

How the Beaufort Cipher Is Broken

Like the Vigenère cipher, Beaufort is a short repeating key applied letter by letter, so the same attacks work. Friedrich Kasiski's 1863 method looks for repeated fragments in the cipher text, whose spacing is a multiple of the key length; William Friedman's index of coincidence, developed around 1920, estimates the key length statistically. Once the length is known, every n-th letter was enciphered with one key letter, so each column is a simple substitution with a reversed alphabet and falls to frequency analysis. There is also a shortcut: reversing the alphabet of both the cipher text and the key (A↔Z, B↔Y — the Atbash mapping) turns a Beaufort message into an ordinary Vigenère one.

Not for secrets

The Beaufort cipher is a classroom and puzzle cipher. A computer breaks it from a few hundred letters of cipher text, so never use it to protect anything that matters.

Frequently Asked Questions

What is the Beaufort cipher?
The Beaufort cipher is a polyalphabetic substitution cipher that encrypts each letter as the key letter minus the plain letter, modulo 26, using a repeating keyword. It uses the same table as the Vigenère cipher but reads it differently, and it is named after the Royal Navy hydrographer Sir Francis Beaufort.
How is the Beaufort cipher different from the Vigenère cipher?
Vigenère adds the key letter to the plain letter (C = P + K), while Beaufort subtracts the plain letter from the key letter (C = K − P). As a result Beaufort is reciprocal — the same operation encrypts and decrypts — whereas Vigenère needs a separate decryption step.
How do I decode a Beaufort cipher?
Enter the same keyword and apply the same operation to the cipher text: plain letter = key letter − cipher letter. In this tool you can choose Decode or simply Encode again, and both give the same answer for the classic Beaufort.
What is the variant Beaufort cipher?
The variant Beaufort computes C = P − K, which is the Vigenère cipher's decryption formula. It is decoded by adding the key back, so unlike the classic Beaufort it is not reciprocal. Pick the version your puzzle or textbook specifies.
Is the Beaufort cipher secure?
No. The repeating key leaves the same patterns as Vigenère, so Kasiski examination and the index of coincidence reveal the key length and frequency analysis recovers each key letter. Reversing the alphabets with Atbash even turns it into a Vigenère cipher. Treat it as a historical cipher to learn from.
What happens to spaces and punctuation?
Only the letters A–Z are enciphered. Each keeps its case, accented Latin letters are treated as their base letter, and everything else passes through unchanged without using up a key letter. Turn on groups of five if you want traditional cipher-text blocks.

Related Tools

More in Codes & Ciphers

See all Codes & Ciphers