Base85 / Ascii85 Encoder
Encode bytes to Base85 (Ascii85) and decode them back.
Overview
The Base85 (Ascii85) encoder converts binary data into printable ASCII text that is roughly 25% denser than Base64. Paste raw bytes or hex and get back a compact <~...~> block; paste a Base85 string and it expands back to the original bytes.
Adobe PostScript and PDF use Ascii85 internally for embedded image and font streams; Git uses a similar Z85 variant for binary patches. Anyone debugging a PDF stream, decoding an ASCII85Decode filter, or just looking for a tighter alternative to Base64 in an unrestricted ASCII channel will want this tool.
How it works
Ascii85 groups input bytes into 4-byte chunks, interprets each chunk as a 32-bit big-endian integer, and converts that integer to five base-85 digits in the range ! (33) through u (117). A single all-zero 4-byte group is special-cased to the letter z. Short trailing groups are padded with zero bytes, encoded, and then the output is truncated by the number of pad bytes. The standard Adobe framing brackets the payload with <~ and ~>. Five characters carrying four bytes of payload gives a 1.25x expansion ratio, versus Base64's 1.333x.
Examples
Input: Man
Output: <~9jqo^~>
Input: Hello, world!
Output: <~87cURD]j7BEbo80~>
Input: 4 bytes of 0x00
Output: z
Input: <~87cURD]j7BEbo80~>
Output: Hello, world!
FAQ
What is the difference between Ascii85 and Base85?
Ascii85 is Adobe's specific Base85 variant with <~ ~> framing and the z shortcut for all-zero groups. Z85 is a ZeroMQ variant that uses a different alphabet to avoid quoting issues in JSON and shell strings. Pick the variant your destination system expects.
Why use it over Base64?
Compactness. For large embedded blobs in PDFs or text-only transports, the ~7% byte saving versus Base64 adds up. The trade-off is that some Ascii85 characters (', ", \) still need escaping in many string literals.
Does it handle binary safely?
Yes. Every output character is in the printable ASCII range, with no control characters or whitespace, so the output survives most text-based transports.
Can I round-trip arbitrary data?
Yes. Encoding then decoding produces byte-identical output, including embedded nulls and high-bit bytes.