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.
Letters only. The keyword repeats along the message, one key letter for each letter of text.
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.
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
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B |
| B | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C |
| C | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D |
| D | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E |
| E | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F |
| F | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G |
| G | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H |
| H | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I |
| I | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J |
| J | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K |
| K | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L |
| L | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M |
| M | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O | N |
| N | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P | O |
| O | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q | P |
| P | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R | Q |
| Q | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S | R |
| R | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T | S |
| S | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U | T |
| T | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V | U |
| U | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W | V |
| V | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X | W |
| W | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y | X |
| X | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z | Y |
| Y | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A | Z |
| Z | Z | Y | X | W | V | U | T | S | R | Q | P | O | N | M | L | K | J | I | H | G | F | E | D | C | B | A |
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 letter | Key letter | Arithmetic | Cipher letter |
|---|---|---|---|
| F | 5 − 3 = 2 | C | |
| O | 14 − 4 = 10 | K | |
| R | 17 − 5 = 12 | M | |
| T | 19 − 4 = 15 | P | |
| F | 5 − 13 = −8 ≡ 18 | S | |
| O | 14 − 3 = 11 | L | |
| R | 17 − 19 = −2 ≡ 24 | Y | |
| T | 19 − 7 = 12 | M | |
| F | 5 − 4 = 1 | B | |
| O | 14 − 4 = 10 | K | |
| R | 17 − 0 = 17 | R | |
| T | 19 − 18 = 1 | B | |
| F | 5 − 19 = −14 ≡ 12 | M | |
| O | 14 − 22 = −8 ≡ 18 | S | |
| R | 17 − 0 = 17 | R | |
| T | 19 − 11 = 8 | I | |
| F | 5 − 11 = −6 ≡ 20 | U | |
| O | 14 − 14 = 0 | A | |
| R | 17 − 5 = 12 | M | |
| T | 19 − 19 = 0 | A |
Showing the first 20 letters.
How to Use the Beaufort Cipher Tool
- 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. Enter a keyword. Only its letters count. The keyword repeats along your message, advancing one key letter for every letter of text.
- 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. 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.
| Plain | Key | Sum | Cipher |
|---|---|---|---|
| D (3) | F (5) | 5 − 3 = 2 | C |
| E (4) | O (14) | 14 − 4 = 10 | K |
| F (5) | R (17) | 17 − 5 = 12 | M |
| E (4) | T (19) | 19 − 4 = 15 | P |
| N (13) | F (5) | 5 − 13 = −8 ≡ 18 | S |
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.