Base91 encoder and decoder
Paste text or hex bytes to encode them with basE91, or switch to Decode to turn basE91 back into text or bytes. basE91 uses 91 printable ASCII characters, so its output is noticeably shorter than Base64 for the same data.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose Encode or Decode.
- Set Bytes as: Text (UTF-8) for ordinary text, or Hex bytes for binary data written as hex.
- Type or paste the input; copy the result.
How it works
basE91 keeps a bit queue. Each input byte is added to it; when more than 13 bits are waiting, the encoder looks at the lowest 13 bits:
- if their value is above 88, it takes those 13 bits;
- otherwise it takes 14 bits (a 14-bit value whose low 13 bits are 88 or less is still below 91 × 91 = 8281).
The chunk v is written as two characters: v mod 91, then v div 91. At the end, the remaining bits become one or two more characters. The decoder reverses this: it reads characters in pairs, rebuilds v and knows from v whether it carried 13 or 14 bits.
Worked example
Encoding the text test (bytes 74 65 73 74):
- the first two bytes give the bit queue 0x6574; its low 13 bits are 0x0574 = 1396, which is above 88, so 13 bits are taken;
- 1396 mod 91 = 31 → f, 1396 div 91 = 15 → P;
- the rest of the bytes continue the same way and the result is fPNKd.
Hello, World! encodes to >OwJh>}AQ;r@@Y?F.
Tips
- basE91 output contains “ and other symbols — put it in single quotes in a shell, or escape it in JSON.
- There is no padding and no checksum: a cut-off string decodes to fewer bytes without an error.
- For a URL-safe format, use Base64 (URL variant) or Base58.
Frequently asked questions
What is basE91?
A binary-to-text encoding by Joachim Henke. It reads the input 13 or 14 bits at a time and writes each chunk as two characters from an alphabet of 91 printable ASCII characters: A–Z, a–z, 0–9 and the symbols !#$%&()*+,./:;<=>?@[]^_`{|}~".
How much smaller is basE91 than Base64?
Base64 always adds 33 % (4 characters per 3 bytes). basE91 adds between about 14 % and 23 %, depending on the data, because 91 × 91 = 8281 values can carry 13 bits and often 14. Hello, World! (13 bytes) is 16 characters in basE91 and 20 in Base64.
Which characters does basE91 avoid?
Space, apostrophe ('), hyphen (-) and backslash (\), plus all control characters. That keeps the output safe in most text fields, but it does use quotes and symbols, so it is not safe in URLs or file names without escaping.
Are line breaks allowed in the encoded text?
Yes. When decoding, spaces and line breaks are skipped, so wrapped basE91 decodes fine. Any other character outside the alphabet is reported as an error.