b2KIT

Base85 / Ascii85 Encoder / Decoder

Encode and decode data using Base85 (Ascii85, Z85, or RFC 1924) encoding variants.

Tested tool guide Tested browser tools Checked August 16, 2026

What Base85 / Ascii85 Encoder / Decoder does, with a checked example

This tool takes bytes (typed text or a pasted string) and encodes them into one of three Base85 dialects, or reverses the process. Ascii85 and Z85 both work by treating each 4-byte group as a big-endian 32-bit number and re-expressing it in base 85 as 5 characters. RFC 1924 was originally defined to encode a whole 128-bit IPv6 address as a single 20-digit base-85 number, not as a general 4-byte-block codec, so this tool's block-wise application of the RFC 1924 alphabet to 4-byte groups is an adaptation rather than something the RFC itself specifies. Each variant also uses a different 85-character alphabet and different rules for a final partial group. The mistake people make most often is decoding output with the wrong variant selected - if the wrong alphabet happens to contain all the characters in the input and the length is otherwise valid, decoding silently returns wrong bytes; only when the input has characters outside that alphabet or violates its length rules does the wrong-variant decode fail with an error.

Worked example

A concrete input and expected output from the current implementation.

Input

Man  (Ascii85 encode, 4 ASCII bytes: M a n and a trailing space)

Expected output

9jqo^

The 4 bytes 0x4D 0x61 0x6E 0x20 form the 32-bit value 1,298,230,816, which in base 85 is digits 24,73,80,78,61; adding Ascii85's offset of 33 to each gives the characters 9, j, q, o, ^ - this is the standard worked example from Adobe's own Ascii85 documentation.

How the result is produced

1

4-byte to 5-character grouping

Input is split into 4-byte groups, each read as an unsigned 32-bit big-endian integer, then converted to base 85 and written as 5 characters using the selected variant's alphabet. Ascii85 additionally shortcuts an all-zero 4-byte group to a single 'z' character on encode, which this tool expands back on decode.

2

Variant-specific alphabets and padding

Ascii85 uses ASCII 33-117 ('!' through 'u'); Z85 uses an 85-character set of digits, letters, and symbols chosen to avoid characters that need escaping in C string literals and other structured text; RFC 1924 uses its own ordering aimed at IPv6 literals. Ascii85 has a defined rule for a final partial group (it is padded with zero bytes before encoding, and the corresponding extra output characters are trimmed). Standard Z85 requires the input length to be a multiple of 4 bytes and defines no partial-group rule, and RFC 1924 likewise defines no general partial-block padding rule, so any partial-group handling this tool applies for Z85 or RFC 1924 input is a tool-specific extension, not a rule of those variants.

Good uses

  • Embedding a binary blob (a compressed chunk, an image fragment, a cryptographic key) as printable text inside a PostScript, PDF, or config file that expects Ascii85 or Z85 content
  • Producing or reading a ZeroMQ CURVE key or other Z85-encoded token for a messaging config that specifically requires the Z85 alphabet rather than Base64
  • Pulling an Ascii85-encoded stream out of a PDF or PostScript file (for example between <~ and ~> markers) and decoding it back to raw bytes for inspection

Limits and checks

  • The three variants share the same base-85 arithmetic but different alphabets, so decoding with the wrong variant selected does not always fail: if the input's characters are all valid in the wrong alphabet and its length is acceptable, you silently get wrong bytes instead of an error - always confirm which variant produced the data before decoding it
  • Z85 is defined only for input lengths that are a multiple of 4 bytes; if your data isn't, you (or the tool) must decide how to pad it, and that padding has to be tracked and removed correctly to recover the original length
  • Ascii85 output can include characters such as backslash, quote, and apostrophe that need escaping if you paste the result directly into source code, JSON, or a shell command

Common questions

Is Base85 output smaller than Base64?

Yes - Base85 has about 25% size overhead versus Base64's roughly 33%, since it packs 4 bytes into 5 characters instead of 3 bytes into 4. It is not a universal win though: standard Base64's alphabet includes '+' and '/', which are not URL- or filename-safe without switching to the separate Base64url variant, and Z85's alphabet also includes URL-significant characters such as '/', '?', '&', '%', and '#' - Z85 was designed for convenient embedding in source code and structured text, not specifically for URL or filename safety.

Can I paste a PDF's Ascii85 stream straight in and decode it?

Usually, but strip the optional Adobe delimiters '<~' and '~>' first if present, and remove any line breaks or whitespace the PDF inserted for line length - Ascii85 ignores whitespace between characters in principle, but this tool expects a clean run of valid alphabet characters for a reliable decode.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools