Bacon's Cipher Encoder & Decoder

Steganographic 5-bit binary cipher using A/B substitution.

Free Bacon's cipher tool that encodes each letter as a 5-symbol AABBA group and decodes it back. Uses the classic 24-letter scheme (I/J and U/V shared) and accepts 0/1 input, in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How does Bacon's cipher work?

Each letter is assigned a unique 5-symbol sequence of two characters, traditionally A and B. For example A=AAAAA and B=AAAAB. A message is encoded by replacing every letter with its 5-symbol group.

Bacon’s cipher, devised by Francis Bacon around 1605, is really a method of steganography: it encodes a message as a binary pattern and then hides that pattern inside ordinary-looking text. Each letter of the secret message becomes a group of five symbols drawn from just two values, traditionally written as A and B. This tool encodes text into those 5-symbol groups and decodes them back, in your browser.

How it works

Assign every letter a fixed 5-symbol code built from two characters. With five positions and two values there are 32 possible patterns, more than enough for the alphabet. The classic 24-letter table starts at A=AAAAA, B=AAAAB, C=AAABA and continues in order, with I and J sharing a code and U and V sharing a code.

To encode, replace each letter with its group and discard anything that is not a letter. To decode, normalise the input into A and B symbols (treating 0 as A and 1 as B), split it into groups of five, and look each group up in the table. Bacon’s true trick was then to hide the A/B values as two slightly different fonts inside an innocent cover text.

The 24-letter alphabet table

LetterCodeLetterCodeLetterCode
AAAAAAI/JABAAARBAAAA
BAAAABKABAABSBAAAB
CAAABALABABATBAABA
DAAABBMABABBU/VBAABB
EAABAANABBAAWBABAA
FAABABOABBABXBABAB
GAABBAPABBBAYBABBA
HAABBBQABBBBZBABBB

Worked example

Encode the word GERA in the 24-letter scheme:

LetterCode
GAABBA
EAABAA
RBAAAA
AAAAAA

GERAAABBA AABAA BAAAA AAAAA

Decoding those groups returns the original letters.

The steganographic application

Bacon’s original method did not transmit A and B symbols as visible text — that would be trivially readable. Instead, he described how to hide the binary pattern inside a cover text by using two subtly different typefaces: one typeface for A-valued letters and another for B-valued letters. A reader who did not know to look for the distinction saw ordinary prose. A reader who knew the system could read each letter as A or B, group the binary sequence into fives, and decode the hidden message.

This makes Bacon’s cipher a classical example of steganography (hiding that a message exists) as distinct from cryptography (hiding what a message says). In its original form it is not a cipher in the modern sense — the “key” is just the two-font convention, and anyone who notices the font variation can decode it immediately.

24-letter versus 26-letter version

The 24-letter scheme reflects 16th and 17th century English orthography, when I and J were considered the same letter (interchangeable in printing), and U and V were similarly treated as a single letter in different positional roles. This means encoding and decoding is slightly ambiguous for words containing these letters — I/J round-trip to I, and U/V round-trip to U. The 26-letter variant (developed later) gives each modern letter a unique code but breaks compatibility with Bacon’s original table. This tool implements the classic 24-letter scheme.