What is the Baconian cipher?

The Baconian cipher, or Bacon's cipher, replaces every letter of a message with five A's and B's, such as AABBB for H. Francis Bacon devised it in 1605, and it's also a way to hide a message in plain sight. You write an ordinary cover text with one letter for each A and B of the code, and set each of its letters in one of two typefaces, one standing for A and the other for B. It still turns up in geocaches and puzzle hunts, where the A's and B's can hide in bold and plain letters, two fonts, or capitals and small letters.

How the code works

Number the letters from 0 for A, and write each number as five binary digits, with A for 0 and B for 1. In the 26-letter alphabet, every letter has a group of its own:

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

So CAKE becomes AAABA AAAAA ABABA AABAA. Bacon's own alphabet has 24 letters: I and J share ABAAA, U and V share BAABB, and the other letters take the groups in order, so K is ABAAB and Z is BABBB.

Tool description

Type your message in the Plain text box, and the Cipher text box spells it out in A's and B's as you go, five for each letter, with a space between the groups. The Alphabet menu below the Cipher menu offers 26 letters, where it starts, and 24 letters (I = J, U = V), Bacon's original. Insert sample enters See you at the park at noon with 26 letters, which gives 21 groups, starting with BAABA AABAA AABAA. A press on the swap button makes the tool a decoder, with the A's and B's moved over as the input. The Cipher menu reaches the rail fence cipher and the rest of the classical ciphers, and to read a code written in A's and B's, there's the Baconian Cipher Decoder.

Examples

Plain text Alphabet Cipher text
Picnic 26 letters ABBBB ABAAA AAABA ABBAB ABAAA AAABA
Good job! 26 letters AABBA ABBBA ABBBA AAABB ABAAB ABBBA AAAAB
Crêpe 26 letters AAABA BAAAB AABAA ABBBB AABAA
Jelly 24 letters ABAAA AABAA ABABA ABABA BABBA
Have fun 24 letters AABBB AAAAA BAABB AABAA AABAB BAABB ABBAA

What gets written

  • Only letters become A's and B's. Spaces, digits, punctuation and line breaks are left out, so the groups run on without word gaps: Cake at 5! gives six groups, for C, A, K, E, A and T.
  • Capitals and small letters get the same groups.
  • Accents are dropped, so ê is written as E, and ß becomes SS. Letters with no plain letter inside, such as ø and æ, are left out, and so are Greek and Cyrillic letters.
  • With 24 letters, J is written as I and V as U, so Jelly comes back as IELLY. Use 26 letters when every letter should come back as it was.

Hiding a message in plain sight

The tool writes the A's and B's, and hiding them is up to you. Take a cover sentence with as many letters as the code has A's and B's, and set the letters that stand for B apart, in bold, in another font or as capitals. HI is AABBB ABAAA, so in the ten letters of Sunny today, the 3rd, 4th, 5th and 7th go in bold: Sunny today. Encoding happens in your browser, and your text never leaves your device.