Bacon's Cipher: History and How to Decode It

2026-06-09 · 5 min read

Bacon's Cipher: History and How to Decode It

Figure 1: Bacon's Cipher

What is Bacon's Cipher?

Bacon's cipher is a steganographic encoding method invented by Sir Francis Bacon in 1605. It hides a secret message inside a piece of ordinary-looking text by using two different styles of letters or characters.

Each letter of the secret message is represented by a five-character sequence of two symbols, traditionally labeled A and B.

The method is notable because the encoded message is invisible to a casual reader. The carrier text looks normal but contains a hidden message encoded in the way it is styled or formatted.


Who Invented Bacon's Cipher?

Sir Francis Bacon, the English philosopher, statesman, and author, described the cipher in his 1605 work The Advancement of Learning.

Bacon designed it as a steganographic tool, meaning the goal was to hide the existence of the message, not just scramble its contents.

He proposed using two visually similar but distinct typefaces to represent the A and B symbols. A reader looking at the text casually would see a normal document, while someone who knew the method could extract the hidden message.


How Bacon's Cipher Works

Every letter of the alphabet is assigned a unique five-character binary-style code using only A and B.

The standard Bacon's cipher alphabet:

Letter Code Letter Code
A AAAAA N ABBAA
B AAAAB O ABBAB
C AAABA P ABBBA
D AAABB Q ABBBB
E AABAA R BAAAA
F AABAB S BAAAB
G AABBA T BAABA
H AABBB U/V BAABB
I/J ABAAA W BABAA
K ABAAB X BABAB
L ABABA Y BABBA
M ABABB Z BABBB

Note: The original cipher treated I and J as the same letter, and U and V as the same letter, giving 24 entries for 26 letters. Modern versions often use a 26-letter version with unique codes for every letter.


Encoding a Message with Bacon's Cipher

To encode the word SECRET:

  1. S = BAAAB
  2. E = AABAA
  3. C = AAABA
  4. R = BAAAA
  5. E = AABAA
  6. T = BAABA

Combined code:

BAAAB AABAA AAABA BAAAA AABAA BAABA

This 30-character A/B string is then hidden inside a carrier text by using two different letter styles for each character.

For example, a carrier sentence might use bold letters to represent B and normal letters to represent A:

Carrier text where bold = B and normal = A:

**S**end **a**ll **a**vailable **r**esources **a**nd **t**ools

A reader sees a normal sentence. The decoder reads the style pattern and extracts the hidden message.


Variations of Bacon's Cipher

Several variations exist depending on context:

  1. Classic A/B notation: The encoded string is written directly as sequences of A and B characters.
  2. Binary notation: A is replaced with 0 and B with 1.
  3. Typeface steganography: Two fonts or text styles represent A and B within a carrier text.
  4. Case steganography: Uppercase letters represent one symbol and lowercase represent the other.
  5. Whitespace steganography: Spaces and tabs represent the two symbols.

In CTF challenges, the most common form presents the cipher as a direct string of A and B characters or as a binary string of 0s and 1s.


How to Decode Bacon's Cipher

To decode a Bacon-encoded message:

  1. Split the input into groups of five characters.
  2. Match each group against the Bacon alphabet table.
  3. Write down the corresponding letter for each group.
  4. Combine the letters to read the hidden message.

Example:

Input:

AABAA AAAAB BABAA AABAA ABABA

Decode each group:

  • AABAA = E
  • AAAAB = B
  • BABAA = W
  • AABAA = E
  • ABABA = L

Result: EBWEL


Bacon's Cipher in CTF Challenges

Bacon's cipher appears in CTF competitions for several reasons:

  1. It looks unusual because of the long A/B sequences.
  2. It requires knowledge of a specific alphabet table.
  3. It can be combined with other ciphers or encoding layers.
  4. It appears in steganography challenges where the encoding is hidden inside formatted text.

Common CTF formats for Bacon's cipher:

  1. A string of As and Bs that appears random but decodes to a flag.
  2. A block of text where two letter styles or two character types carry the hidden message.
  3. A binary string (0s and 1s) that maps to the same Bacon alphabet.
  4. An image or document where text formatting encodes the message.

How to recognize it in a CTF:

If you see a long string using only the letters A and B, and the length is a multiple of five, Bacon's cipher is a strong candidate.


Bacon's Cipher vs Binary Encoding

Bacon's cipher and binary encoding look similar because both use two-symbol sequences. The difference is in the alphabet mapping.

Feature Bacon's Cipher Binary (ASCII)
Symbols used A and B 0 and 1
Bits per character 5 7 or 8
Alphabet Custom Bacon table ASCII table
Origin 1605 Modern computing
CTF frequency Occasional Very common

If a string of 0s and 1s does not decode correctly as ASCII, trying the Bacon alphabet with 0 as A and 1 as B is worth attempting.


Decode Bacon's Cipher Online

You can decode Bacon's cipher instantly at KeyDecryptor Bacon Cipher Decoder.

Steps:

  1. Paste your A/B encoded string.
  2. Select the cipher variant if needed.
  3. Click Decode to extract the hidden message.

The tool handles both classic and modern 26-letter variants.


Frequently Asked Questions

Is Bacon's cipher still used today?

Bacon's cipher is not used for modern security. It is studied for its historical significance and appears in puzzles, CTF challenges, and steganography demonstrations.

Is Bacon's cipher encryption or steganography?

It is primarily steganography because its goal is to hide the existence of a message within a carrier text, not to mathematically scramble its contents. When used as a direct A/B encoding without a carrier, it functions more like encoding.

How many characters does Bacon's cipher use per letter?

Each letter requires exactly five A or B characters. A 10-letter message produces a 50-character encoded string.

Can Bacon's cipher hide messages in images or audio?

Yes. The two-symbol principle can be applied to any medium with two distinguishable states, including pixel colors, audio frequencies, or whitespace patterns. These are steganographic applications of the same concept.

What is the difference between the 24-letter and 26-letter Bacon alphabet?

The original Bacon alphabet used 24 entries by treating I and J as the same and U and V as the same. The modern 26-letter version assigns a unique code to every letter. CTF challenges may use either version, so checking both is useful if your first attempt fails.