Base85 Encoder and Decoder

Base85 squeezes four bytes into five ASCII characters — denser than Base64’s 3-for-4 ratio — by using an 85-character alphabet instead of 64. Adobe’s Ascii85 variant ships inside every PostScript and PDF file; the newer Z85 (ZeroMQ) variant avoids characters that break inside C strings and XML. This tool encodes and decodes both, with optional delimiters.

How to convert Base85

  1. 1

    Pick the variant

    Ascii85 for PDF/PostScript assets; Z85 for source code and network protocols.

  2. 2

    Paste text or upload a file

    Encode direction takes raw bytes; decode direction takes a Base85 string.

  3. 3

    The encoder chunks by 4 bytes

    Every 4-byte block becomes a 5-character Base85 string. The final block is padded and truncated.

  4. 4

    Copy the result

    Ascii85 optionally wrapped with `<~` and `~>` delimiters; Z85 without delimiters.

Size overhead comparison

Encoding Chars per 4 bytes Overhead vs binary
Hex 8 +100%
Base64 5.33 (rounded up to 8 with padding) +37%
Base85 5 +25%
Raw binary 4 0

So 1 MB of binary becomes 1.25 MB in Base85, 1.33 MB in Base64, 2 MB in hex.

Ascii85 vs Z85 alphabets

Ascii85 (RFC 1924 / Adobe): characters ! through u (33-117 in ASCII), plus z as a shortcut for 4 zero bytes. Used in PostScript and PDF streams, wrapped as <~...~>.

Z85 (ZeroMQ): a subset that avoids quote characters and escapes:

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#

Safe to embed in JSON, XML, C strings and source code without escaping.

How the math works

Every 4 bytes are read as a big-endian 32-bit integer N. The 5 output characters are the digits of N in base 85, most significant first. 85^5 = 4 437 053 125 which is greater than 2^32, so 4 bytes always fit in 5 characters.

When Ascii85 matters

Open any PDF in a text editor and search for ASCII85Decode — Adobe uses it as a filter for embedded images and fonts that need to survive a 7-bit transport (old fax-style systems). Z85 is widely used in ZeroMQ CURVE authentication keys.

Special cases

  • All-zero 4-byte block — Ascii85 encodes it as the single character z instead of !!!!!.
  • All-space 4-byte block — Some variants use y for four spaces, others do not.
  • Last partial block — Padded with zero bytes, and the corresponding number of output characters is truncated at the end.

Frequently Asked Questions

Smaller output, yes. Universally compatible, no. Base85 contains characters like <, >, &, " (in Ascii85) that need escaping in XML, JSON and URLs. Z85 avoids this but most tooling speaks Base64 natively.

Ascii85 if you are working with PostScript or PDF files. Z85 for source code, config files and network protocols. RFC 1924 IPv6 encoding is a different assignment of the same 85 characters and is rarely used in practice.

No. They use different alphabets. Decoding Ascii85 with a Z85 table will produce garbage. Pick one before encoding and stick to it.

For Adobe Ascii85 in PDF or PostScript streams, yes — they mark the encoded region. For standalone use and all Z85 output, no delimiters are needed.

Related Tools