Xerobit

Bacon Cipher: Encode and Decode Text

The bacon cipher converts each letter of your message into a group of five A and B characters, or decodes those groups back into readable text. Decoding detects A/B or 0/1 groups automatically. Choose the classic 24-letter alphabet or the 26-letter version. Everything runs in your browser.

Result

AABBB AABAA ABABB ABABB ABBBA

How to use the bacon cipher

  1. Select Encode or Decode from the direction menu.
  2. Type or paste your text into the input area. For decoding, enter groups of five A/B or 0/1 characters.
  3. Choose the 24-letter or 26-letter alphabet variant.
  4. Pick whether you want the encoded output displayed as A/B or 0/1.
  5. The result updates instantly as you type.

How the Bacon cipher works

The bacon cipher, also called the Baconian cipher, was invented by Sir Francis Bacon in 1605. It replaces every letter with a unique sequence of five binary characters, traditionally written as A and B. Because each position can be one of two values, five positions yield 25 = 32 possible combinations, which is more than enough for the 26 letters of the English alphabet.

To encode the word HELLO using the 26-letter variant, look up each letter's index starting from zero: H is 7, E is 4, L is 11, and O is 14. Convert each index to a five-digit binary number where A represents 0 and B represents 1:

  • H (7) becomes 00111, written as AABBB
  • E (4) becomes 00100, written as AABAA
  • L (11) becomes 01011, written as ABABB
  • L (11) becomes 01011, written as ABABB
  • O (14) becomes 01110, written as ABBBA

The final encoded message is AABBB AABAA ABABB ABABB ABBBA. Letters are separated by a space, a space between words is written as a slash, and punctuation passes through unchanged.

24-letter versus 26-letter alphabets

Bacon originally designed his cipher for a 24-letter alphabet where I and J shared the same code, and U and V shared another. This matched the Latin alphabet conventions of the early 17th century. In this scheme, only 24 of the 32 possible five-character combinations are used.

The modern 26-letter variant assigns a distinct code to every letter from A to Z. When using this tool as a bacon cipher decoder, make sure you select the same variant that was used during encoding. If you try to decode a 24-letter message with the 26-letter setting, letters like J and V will map to different codes and produce incorrect results.

Reference table for the 26-letter variant

The following table shows the A/B encoding for every letter in the 26-letter alphabet. Each code is simply the letter's zero-based position converted to five-bit binary, with 0 replaced by A and 1 replaced by B.

LetterCodeLetterCode
AAAAAANABBAB
BAAAABOABBBA
CAAABAPABBBB
DAAABBQBAAAA
EAABAARBAAAB
FAABABSBAABA
GAABBATBAABB
HAABBBUBABAA
IABAAAVBABAB
JABAABWBABBA
KABABAXBABBB
LABABBYBBAAA
MABBAAZBBAAB

The tool computes these codes from the letter position, so the table always matches the output. The 24-letter variant folds J into I and U into V, so letters after I move down one place and letters after T move down two. For example K is ABAAB there instead of ABABA, and W is BABAA instead of BABBA.

Steganography and hidden messages

Bacon did not invent this system merely to scramble text. His real innovation was steganography: hiding the existence of a message entirely. He proposed using two distinct typefaces in an otherwise ordinary document. One font represented A and the other represented B. A reader who knew the key could extract the hidden message letter by letter, while anyone else would see only a normal paragraph.

This approach differs fundamentally from substitution ciphers like the caesar cipher translator or the vigenere cipher, which obscure meaning but make it obvious that a secret exists. The bacon cipher conceals both the content and the fact that communication is happening at all.

Common mistakes when decoding

When acting as a bacon cipher decoder, the most frequent error is mixing up the alphabet variants. Always confirm whether the sender used the 24-letter or 26-letter system before decoding. Another common issue is losing track of non-letter characters. Punctuation and line breaks are not encoded and stay in place, and a slash between groups is read as a word break. Spaces between groups are ignored when decoding, but a stray character inside a group of five makes the decoder stop with an error.

Finally, remember that A/B and 0/1 are interchangeable representations. When decoding, the tool detects whether your groups use A and B or 0 and 1 and reads them accordingly, so the output style selector only matters when encoding. If the text mixes both kinds of symbols, the selector breaks the tie, and if it contains neither, the tool reports an error instead of echoing your input back.

Worked examples

ExampleInputResult
Encode HELLO (26-letter)Direction: encode; Text: HELLO; Alphabet variant: 26; Output style (encode): abAABBB AABAA ABABB ABABB ABBBA
Decode AABBB AABAA (26-letter)Direction: decode; Text: AABBB AABAA ABABB ABABB ABBBA; Alphabet variant: 26; Output style (encode): abHELLO
Encode SOS (24-letter, binary)Direction: encode; Text: SOS; Alphabet variant: 24; Output style (encode): 0110001 01101 10001

FAQ

What is the bacon cipher?

The bacon cipher is a method of encoding text where each letter is replaced by a unique sequence of five A and B characters. It was created by Francis Bacon in 1605 primarily as a way to hide messages inside ordinary-looking documents.

What is the difference between the 24-letter and 26-letter variants?

The 24-letter variant merges I with J and U with V, reflecting historical Latin alphabet usage. The 26-letter variant assigns a distinct five-character code to every letter from A to Z.

Can I use 0 and 1 instead of A and B?

Yes. The A/B notation is traditional, but 0/1 is mathematically identical since the cipher is based on binary values. Use the output style selector to choose which one is produced when encoding. When decoding, the tool detects A/B or 0/1 groups on its own.

Does the bacon cipher encrypt numbers and punctuation?

No. Only letters are converted into five-character groups. Punctuation passes through unchanged, and a space between words is written as a slash so it is not confused with the gap between letters.

Is the bacon cipher secure for modern use?

No. Like other classical methods such as the affine cipher or rail fence cipher, it provides no real cryptographic security today. It is useful for puzzles, education, and historical study.

How do I decode a Baconian cipher message?

Set the tool to Decode, paste your sequence of A/B or 0/1 groups, and select the correct alphabet variant. The symbol set is detected automatically, and each five-character group is translated back into its letter.