Bacon Cipher (How it Works, Example & Decoder)

Learn how to encode and decode the Bacon cipher step by step using binary A/B patterns and an interactive Bacon cipher decoder.

The Bacon cipher encodes every letter as exactly 5 symbols — either A or B — based on its binary index. It is the world’s first known binary alphabet and the foundation of typographic steganography.

In a nutshell

The Bacon cipher (or biliterary cipher) encodes each letter as 5 symbols A or B based on its binary index: A=AAAAA, B=AAAABZ=BBBBB. Its real power is steganography: hiding the message inside normal text using two different typefaces so no one suspects a secret message exists.

Reviewed by the Let's Cipher editorial team Reading time: ~7 min Level: Beginner

Francis Bacon published his biliterary cipher in De Augmentis Scientiarum (1623) as a method to hide secret messages inside ordinary texts using two distinct typefaces. His ingenious contribution was not just the code itself, but the idea of typographic steganography.

  • Type: Biliterary / steganographic cipher
  • Symbols: Only A and B (5 per letter)
  • Base: 5-bit binary code
  • Security: Very low (public fixed mapping)

Origin and History of the Bacon Cipher

The Bacon cipher (also known as the Baconian cipher or biliterary cipher) was invented by the English philosopher and statesman Sir Francis Bacon (1561–1626) and published in his work De Augmentis Scientiarum in 1623. Bacon designed the system as a method of steganography: not merely to cipher a message, but to hide the very existence of the message inside an apparently innocent text.

The central idea is elegant: Bacon’s original 24-letter alphabet (where I=J and U=V share a code) — or the 26 letters in William Friedman’s modern variant — is encoded into groups of 5 binary symbols, using two variants: A (for 0) and B (for 1). The mathematical foundation is simple: with 5 positions and 2 options per position you get 2&sup5; = 32 possible combinations, more than enough to cover the Latin alphabet.

In the original steganographic application, the carrier message was written in two slightly different typefaces: one representing A and the other B. An unsuspecting reader saw ordinary text; a trained recipient extracted the hidden message letter by letter by reading groups of five. Unlike the Caesar cipher or the Vigenère cipher, Bacon does not shift letters: it encodes them in a binary-before-binary system, conceptually anticipating ASCII and the dot-dash codes of the 19th century.

How the Bacon cipher works step by step

  • Assign an index to each letter: A=0, B=1, C=2 … Z=25.
  • Convert to 5-bit binary: A=00000, B=00001, C=00010 … Z=11001.
  • Replace 0→A and 1→B: each 0 bit is written as A and each 1 bit as B. The result is a group of exactly 5 letters (only A and B) for each character of the original message.
  • Complete ciphertext: groups are concatenated (with an optional separator) to form the ciphertext. Each original letter produces exactly 5 characters in the output.
  • Decoding (Bacon cipher decoder): split the A/B string into blocks of 5, convert B→1 and A→0, interpret as binary, and obtain the corresponding letter.

Follow this Bacon cipher step by step guide and verify each result with the Bacon cipher decoder below — the fastest way to encode and decode online.

Key property: the ciphertext is exactly 5 times the length of the original message (in alphabetic characters). A 6-letter message produces 30 A/B symbols. This fixed expansion ratio is the diagnostic signature of the Bacon cipher.

Bacon Cipher Simulator & Decoder

Encrypt converts letters into groups of 5 (A/B). Decrypt converts groups of 5 back into letters.
Group separator:
Bacon cipher example: type BACON and click Encrypt → you will get AAAAB AAAAA AAABA ABBBA ABBAB. Paste that result and click Decrypt to recover BACON.

Bacon cipher example explained with a table

This Bacon cipher example step by step shows exactly how each letter maps to its 5-symbol A/B code.

Message: BACON
Process: letter → index → binary (5 bits) → A/B code

Letter Index Binary (5 bits) Bacon code
B 1 00001 AAAAB
A 0 00000 AAAAA
C 2 00010 AAABA
O 14 01110 ABBBA
N 13 01101 ABBAB

Result: AAAAB AAAAA AAABA ABBBA ABBAB

To decode: remove spaces → group in blocks of 5 → convert A→0, B→1 → interpret binary → letter.

Complete Bacon cipher table (A–Z)

Modern 26-letter variant (unique codes per letter). Generated dynamically by the simulator.

Letter A/B Code Binary

The Bacon cipher as steganography

Bacon’s greatest innovation was not the code itself, but its steganographic application: hiding the encoded message inside a normal carrier text so that no one suspects secret communication is taking place.

Bacon steganography example:

Suppose you want to hide the letter H (index 7 = 00111 = AAABB).

You write a 5-word carrier text with two typefaces:

All is well here today

Normal typeface = A (0). Bold/italic typeface = B (1). Reading the 5 groups: A, A, B, B, B → 00111 → index 7 → H.

This technique was rediscovered in the 20th century and is the conceptual basis of modern digital watermarking: hiding information inside a carrier medium by varying imperceptible properties (typeface, spacing, pixels, etc.).

What is the Bacon cipher used for?

History & literature

Foundation of the theory that Bacon hid messages in Shakespeare’s works. Frequently cited in literary studies and historical cryptography.

Education

Introduces binary encoding, number bases, and steganography in a visual and intuitive way, without complex algebra.

CTF & puzzles

Appears frequently in Capture the Flag competitions and escape rooms, often camouflaged inside apparently normal text using two typographic styles.

Digital watermarking

Conceptual precursor of modern watermarking: hiding information in imperceptible variations of a carrier medium (audio, image, video).

How to break the Bacon cipher

Breaking the Bacon cipher step by step is trivial because the letter→code mapping is public, fixed, and keyless: simply group the symbols in blocks of 5 and look them up in the table.

Direct attack (visible A/B text)

If the ciphertext explicitly shows A and B symbols, the attack is immediate: remove separators, group in blocks of 5, and convert each group to the corresponding alphabet letter. With no secret key there is no possible resistance.

Steganographic attack (two typefaces)

If the message is hidden in a carrier text using two fonts, the attacker looks for subtle typographic variations (weight, serifs, spacing) via forensic document analysis. Text editing or font-comparison tools reveal it in minutes.

How to detect a Bacon cipher

Knowing how to detect the Bacon cipher is straightforward if you know its three diagnostic signatures. Any of these signals in an unknown text should alert you immediately:

Only letters A and B

The ciphertext contains exclusively and only the letters A and B (upper or lower case). No other character appears in the body of the message, except separators such as spaces or dashes.

AAAAB AAAAA AAABA ← only A/B

Groups of exactly 5

After removing separators, the remaining number of A/B characters is always a multiple of 5. Each block of 5 represents a single letter of the original message. If it is not a multiple of 5, the text is incomplete or corrupt.

AAAAB | AAAAA | AAABA
5 + 5 + 5 = 15 ÷ 5 = 3 letters

Length ×5 of original

The ciphertext is exactly 5 times the length of the original message (in alphabetic characters). A 4-letter message produces 20 A/B symbols. This fixed ratio is the digital fingerprint of the Bacon cipher.

“BACON” → 5 letters
→ 25 A/B symbols

Quick checklist

  • Contains only A and B? → possible Bacon
  • Total length a multiple of 5? → almost certainly Bacon
  • Length ÷ 5 gives a reasonable word count? → confirms Bacon
  • Quick tool: paste the text into the simulator and click Decrypt

Bacon cipher decoding example step by step

Use this Bacon cipher step by step example to practise manually — then confirm every result with the Bacon cipher decoder above.
Received ciphertext: BAABA AAAAA AAABA ABBBA ABBAA

Step 1 — Split into groups of 5

BAABA | AAAAA | AAABA | ABBBA | ABBAA

Step 2 — Convert B→1, A→0 and calculate index

BAABA → 10010 → 18 → S

AAAAA → 00000 → 0 → A

AAABA → 00010 → 2 → C

ABBBA → 01110 → 14 → O

ABBAA → 01100 → 12 → M

Result

Decoded message: SACOM — in a real message with more context, each letter is extracted this way.

Advantages and disadvantages of the Bacon cipher

Advantages

  • Native steganography: the only classical cipher specifically designed to conceal the existence of the message, not just its content.
  • No shared key: the encoding is public; security depends on the recipient knowing how to read the typographic variations in the carrier.
  • Binary precursor: anticipates digital encoding by more than 300 years, making it a historical cornerstone of information theory.
  • Perfect for CTF: its simplicity makes it a classic in cryptography puzzles and Capture the Flag competitions thanks to its recognisability.

Disadvantages

  • No secret key: the mapping is completely public and fixed. Anyone who knows the system can decode the message instantly.
  • ×5 expansion: each original character produces 5 ciphertext symbols, creating very long output that is hard to hide in a carrier text.
  • Detectable: a text containing only the letters A and B is immediately suspicious in the explicit variant.
  • Not suitable for real use: trivially broken in fractions of a second with any script or even manually with the table.

Is the Bacon cipher secure?

Is the Bacon cipher secure?

The Bacon cipher is not secure as a modern cryptographic system. Its letter→code mapping is public and uses no secret key. However, its value is steganographic, not cryptographic:

  • No algorithmic secret: anyone who knows a text uses Bacon can decode it in seconds with the public table — no key needed.
  • Trivial detection: a text composed solely of the letters A and B in groups of 5 is unmistakable to any cryptanalyst with basic experience.
  • Real steganographic value: combined with a well-designed typographic carrier, it can hide the existence of the message. But security depends on the carrier, not the code.

Conclusion: use the Bacon cipher for learning, CTF, or art. For secure communications, use modern standards such as AES-256.

Frequently asked questions about the Bacon cipher

What is the Bacon cipher?

The Bacon cipher (or biliterary cipher) is a system invented by Francis Bacon in 1605 that encodes each letter of the alphabet as a sequence of 5 symbols A or B. It is the earliest known application of a binary code to written language and was designed both as a cipher and as a steganographic tool to hide messages inside normal texts.

How many letters does the Bacon cipher cover?

Bacon’s original version covered 24 letters (I=J and U=V shared a code), since 2&sup5;=32 exceeds the 24 needed combinations. William Friedman’s modern variant extends the system to 26 unique letters, assigning a distinct code to each letter of the modern alphabet, since 32 > 26.

How does the Bacon cipher differ from Morse code?

Both are binary systems for encoding letters, but with key differences: the Bacon code always uses exactly 5 symbols per letter (fixed length); Morse uses variable length (1 to 4 symbols for the most common letters). Bacon uses A/B; Morse uses dot/dash. Morse was optimised for transmission speed, Bacon for typographic steganography.

Did Bacon use this cipher to hide his authorship of Shakespeare’s works?

It is a popular theory but without solid academic evidence. The “Baconian theory” claims that Francis Bacon was the true author of Shakespeare’s works and used his biliterary cipher to hide that fact in the text. Modern cryptologists — including William Friedman and his wife Elizebeth — analysed Shakespeare’s works exhaustively and concluded that no valid hidden Bacon message exists in them.

Where does the Bacon cipher appear in CTF challenges?

In Capture the Flag (CTF) competitions, the Bacon cipher typically appears in two forms: (1) as an explicit string of A and B letters grouped in fives, visually recognisable by its pattern; and (2) steganographically, camouflaged in paragraphs of text where words or letters in italic/bold represent the B and normal ones represent A. Tools like CyberChef include a “Bacon Cipher Decode” module to automate the process.

Bacon cipher summary

The Bacon cipher (1623) is the first known binary language-encoding system: each letter is converted into 5 A/B symbols using its binary index. Its greatest legacy is not cryptographic but steganographic and historical: it anticipates digital binary encoding by three centuries and lays the conceptual foundation of modern watermarking.

Code

5 A/B symbols per letter. No key. Public fixed mapping.

Innovation

First binary language encoding. Precursor of ASCII and digital watermarking.

Security

None as a cipher. Security is steganographic, not cryptographic.

Current use

CTF, binary education, cryptography history, and literary puzzles.