Advertisement

Base85 Encoder & Decoder (Ascii85, Z85)

Encode text or hex bytes to Base85 and decode it back. Supports Ascii85 (PDF/PostScript), the RFC 1924 alphabet used by Python and Git, and ZeroMQ Z85.

Direction
Encoding: text or hex bytes. Decoding: the Base85 characters (spaces and line breaks are ignored).
0 = no line breaks. PostScript files often use 75 or 80.

Base85 packs every 4 bytes into 5 printable characters, so encoded data grows by only 25% — less than the 33% of Base64. This tool encodes text or raw hex bytes, and decodes them back, in the three alphabets you are likely to meet: Ascii85 in PDF and PostScript streams, the RFC 1924 alphabet behind Python's base64.b85encode and Git binary patches, and Z85 from ZeroMQ.

How to use this tool

  1. Choose Encode or Decode.
  2. Pick the variant used by the system you are working with.
  3. Paste text or hex bytes to encode, or the Base85 characters to decode.
  4. For Ascii85, optionally add <~ ~> delimiters or a line length.

Formula

N = b₁×256³ + b₂×256² + b₃×256 + b₄ = c₁×85⁴ + c₂×85³ + c₃×85² + c₄×85 + c₅

Each 4-byte group is read as one 32-bit big-endian number N and rewritten as five base-85 digits c₁ to c₅, which are mapped to characters. Ascii85 adds 33 to each digit (so "!" is 0 and "u" is 84) and writes a single "z" for four zero bytes. A final group of n bytes (n < 4) is padded with zeros, encoded and cut to n + 1 characters; decoding pads with the highest digit and drops the extra bytes. Z85 has no partial groups: input must contain complete four-byte blocks.

Example

The text "Man " is the bytes 4D 61 6E 20, so N = 1,298,230,816. Dividing by powers of 85 gives the digits 24, 73, 80, 78 and 61; adding 33 gives the characters 9, j, q, o and ^. Ascii85 therefore encodes "Man " as 9jqo^ (or <~9jqo^~> with delimiters). "Hello, World!" is 13 bytes — three full groups plus one byte — and encodes to the 17 characters 87cURD_*#4DfTZ)+T.

Frequently asked questions

Which Base85 variant do I need?

Ascii85 for PDF and PostScript (the ASCII85Decode filter) and Python's a85encode. The RFC 1924 alphabet for Python's b85encode, Mercurial and Git binary diffs. Z85 for ZeroMQ keys and for strings embedded in source code, since its alphabet has no quotes or backslash. Always decode with the same variant.

Is Base85 a form of encryption?

No. It is a reversible encoding with no key, and anyone can decode it. It is for moving binary data through channels that only carry text.

Why do some Z85 libraries reject my data?

ZeroMQ RFC 32 requires a byte count divisible by four and an encoded length divisible by five. This tool rejects partial Z85 groups. Any padding must be defined and removed by the surrounding protocol.

Why is the decoded result shown only as hex?

Bytes that are not valid UTF-8, such as a compressed stream or a key, cannot be shown as text, so only the hex is useful.

Sources

Last updated: 2026-10-30

Advertisement