Base91 Encoder/Decoder

High-density printable encoding — denser than Base64

Ad placeholder (leaderboard)

basE91 is a binary-to-text encoding by Joachim Henke designed for maximum density among printable schemes. By packing a variable 13 or 14 bits into each character pair, it carries roughly 14 percent overhead — noticeably tighter than Base64’s fixed 33 percent. This tool encodes UTF-8 text into Base91 and decodes it back, entirely in your browser.

How it works

Base91 streams bits through an accumulator rather than using fixed groups:

  1. Input bytes are shifted into a bit accumulator, eight bits at a time.
  2. Once the accumulator holds more than 13 bits, the low 13 bits are examined. If that value is greater than 88 the encoder consumes 13 bits; otherwise it consumes 14 bits. This keeps every two-character unit within the 8281 combinations that 91 squared provides.
  3. The consumed value is split into two characters: value mod 91 and value / 91, each mapped through the 91-symbol alphabet.
  4. Any leftover bits at the end are flushed as one or two final characters.

Decoding reverses the process, reading two characters into a value, then refilling and draining the bit accumulator a byte at a time, choosing 13 or 14 bits using the same greater-than-88 test.

Tips and example

Encoding the text test produces fPNKd — shorter than the six characters Base64 would use for the same four bytes. The density advantage grows with payload size, so Base91 is a good fit when you are squeezing binary into a text channel and every byte counts. It is not URL-safe out of the box, however: the alphabet includes characters like & and + that need escaping in query strings, so prefer Base62 when the result must live in a URL.

Ad placeholder (rectangle)