Bacon's cipher — encode letters as five-symbol A/B groups

Bacon's cipher turns every letter into a group of five A and B symbols, like a 5-bit binary code; pick the modern 26-letter alphabet or Bacon's original 24-letter one, and A/B, a/b or 0/1 symbols.

Live demo · real result from this tool
Direction
Alphabet
Symbols

Result

AABBB AABAA ABABB ABABB ABBBA

Processed on your device — nothing is uploaded.

How to use the Bacon cipher tool

  1. Choose the Direction: Encode or Decode.
  2. Pick the Alphabet: 26 letters (modern) or 24 letters (Bacon’s: I=J, U=V). Use the same one in both directions.
  3. When encoding, choose the Symbols: A / B, a / b or 0 / 1.
  4. Type into Your text and read the Result. Encoded groups are separated by spaces.

What it does and when to use it

Francis Bacon described this cipher in 1623 as a way to hide a secret inside an innocent text. Every letter becomes five symbols drawn from just two, which is the same idea as 5-bit binary. Today it appears in escape rooms, geocaches and puzzle hunts, where the two symbols might be bold and normal letters or two colours.

The code itself gives no protection: anyone who recognises the pattern can read it, so it is for puzzles and teaching only. Its strength was always in hiding that a message existed. If you are building a puzzle chain, you could encode the result of a Polybius square or A1Z26 step. The binary text converter uses the same two-symbol idea with eight bits per byte.

How it works

Encoding. The text is converted to capitals and everything except A to Z is removed, including spaces and digits. Each letter gets its position, counting from zero, written as five binary digits. With 26 letters, A is 00000, B is 00001 and Z is 11001. With 24 letters, J is treated as I and V as U before the lookup, so the codes after I shift down. Finally 0 and 1 are replaced by your chosen symbols.

Decoding. The tool keeps only a, b, A, B, 0 and 1, reads a or 0 as 0 and b or 1 as 1, and cuts the result into groups of five. A total that is not a multiple of five gives a message. It all runs in your browser.

Worked examples

Results from the tool:

Hello          26 letters, A/B   →  AABBB AABAA ABABB ABABB ABBBA
Jump           24 letters, A/B   →  ABAAA BAABB ABABB ABBBA
Hi, Jo!        26 letters, 0/1   →  00111 01000 01001 01110
BAAAB          24 letters, decode  →  S

In the second line J is encoded as I (ABAAA) and the U uses the 24-letter code BAABB. The third shows the comma, space and exclamation mark disappearing. The last line decodes to S, but the same group in the 26-letter table is R, which is why choosing the right alphabet matters.

Limits and tips

  • Word breaks are lost when encoding. Add a marker of your own, such as a slash, if the reader needs them; the decoder skips it.
  • Decoding a cover text with normal words in it will not work, because the a and b letters inside those words count as symbols. Convert the cover text to A and B by hand first.

Frequently asked questions

Which alphabet should I choose, 26 or 24 letters?
Use whichever the puzzle was made with. Francis Bacon's original table has 24 letters, with I and J sharing a code and U and V sharing a code. Many modern puzzles give every letter its own code instead. If a decoded message looks almost right but some letters are off by one, switch the alphabet.
How was Bacon's cipher used to hide messages?
The A/B groups were meant to be hidden in an ordinary-looking text. Each letter of the cover text is printed in one of two slightly different typefaces, and the reader writes A or B for each one. This tool makes and reads the A/B groups; it does not apply typefaces.
What does the decoder ignore?
Everything except the letters a and b (either case) and the digits 0 and 1. Spaces, punctuation and all other letters are skipped, so a message can be pasted with or without spaces between groups.
Why do I get a question mark?
The group stands for a number beyond the alphabet. With 26 letters the groups go up to BBAAB (Z); with 24 letters they go up to BABBB (Z). A group such as BBBBB is not a letter in either table.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close