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
| Letter | Code | Letter | Code | Letter | Code |
|---|---|---|---|---|---|
| A | AAAAA | I/J | ABAAA | R | BAAAA |
| B | AAAAB | K | ABAAB | S | BAAAB |
| C | AAABA | L | ABABA | T | BAABA |
| D | AAABB | M | ABABB | U/V | BAABB |
| E | AABAA | N | ABBAA | W | BABAA |
| F | AABAB | O | ABBAB | X | BABAB |
| G | AABBA | P | ABBBA | Y | BABBA |
| H | AABBB | Q | ABBBB | Z | BABBB |
Worked example
Encode the word GERA in the 24-letter scheme:
| Letter | Code |
|---|---|
| G | AABBA |
| E | AABAA |
| R | BAAAA |
| A | AAAAA |
GERA → AABBA 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.