Base91 Encoder and Decoder

Convert text, hex bytes or files to basE91 and back. basE91 packs binary data into 91 printable ASCII characters and gives shorter output than Base64 or Base85.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Choose Encode to turn text or bytes into basE91, or Decode to turn basE91 back into data.
  2. Type or paste your input, or open a file. Switch the input to Hex for raw bytes.
  3. The result updates as you type. When decoding, choose Text or Hex output.
  4. Copy the result or download it as a file.

What is basE91?

basE91 is a binary-to-text encoding designed by Joachim Henke. It uses 91 of the 95 printable ASCII characters: everything except the space, the apostrophe ', the hyphen - and the backslash \.

It does not work on fixed blocks of bytes. The encoder collects input bits in a buffer and takes 13 of them at a time. If the 13-bit value is greater than 88, it is written as two characters. If it is 88 or less, a 14th bit is taken as well, which still fits because two base-91 characters can express 91 × 91 = 8281 different values. Every 13 or 14 bits therefore become exactly 2 characters.

The result is an overhead of at most about 23%, and down to about 14% for data with long runs of zero bytes. Random or compressed data comes out close to the upper end.

How basE91 compares

EncodingCharactersSize of output
Hex162 × input
Base5858about 1.37 × input
Base64641.33 × input
Base85 / Ascii85851.25 × input
basE9191about 1.14 to 1.23 × input

To compare real output lengths for your own data, type it into All encodings.

Things to keep in mind

  • Escaping. The alphabet contains the double quote ", which must be escaped in JSON and in most string literals, and <, > and &, which must be escaped in HTML and XML. basE91 is not URL-safe.
  • Decode the whole string. Because bits run across character boundaries, a piece cut from the middle of a basE91 string cannot be decoded on its own.
  • Support. basE91 is not an IETF standard. The author publishes reference implementations in C and other languages, and ports exist for most platforms, such as the base91 package for Python.

Specification

Alphabet91 printable ASCII characters
Output sizeAbout 123%
PaddingNone
StandardbasE91 (Joachim Henke)
Case sensitiveYes

Examples

Input (UTF-8)Output
Hello, World!>OwJh>}AQ;r@@Y?F
Base64.isxD7gXm^?t#5
你好I_5k7aPE

Frequently asked questions

Is basE91 smaller than Base64?

Yes. Base64 always adds 33%, while basE91 adds at most about 23%, and less for data with many zero bytes. For a 1 MB file that is roughly 100 KB saved.

Which characters does basE91 use?
The letters A-Z and a-z, the digits 0-9 and the symbols !#$%&()*+,./:;<=>?@[]^_`{|}~". Space, apostrophe, hyphen and backslash are not used.
Why is it written basE91?

That is how its author spells the name. basE91 and Base91 refer to the same encoding, and this page follows the original algorithm.

Does whitespace break decoding?

No. Spaces and line breaks are not part of the alphabet, so the decoder here ignores them. You can paste wrapped basE91 text directly.