Ascii85 Encoder and Decoder

Encode text or hex bytes to Ascii85, or decode it back. The <~ ~> wrapper, z compression and truncated tails are handled explicitly, not guessed.

Encode: plain text (UTF-8) or hex bytes. Decode: Ascii85, with or without the <~ ~> wrapper. The mode switch decides when the input is ambiguous — this tool will not guess.

Output options — only used when encoding

Auto reads <~ ~> as a wrapped Ascii85 string, hex as bytes, and everything else as text to encode.

When you need this

  • You are implementing the ASCII85Decode filter in a PDF pipeline and want to check a stream against a known-good encoder.
  • A PostScript or PDF producer handed you <~ … ~> wrapped data and you need the bytes underneath it.
  • You captured hex bytes from a protocol and need the Ascii85 form another tool expects.
  • You are comparing size overhead across Base64, Base32 and Ascii85 and want the actual strings, not the percentages.

Why other Ascii85 tools fall short

Many encoders only emit the bare alphabet, so a wrapped string arrives as invalid characters instead of being unwrapped first.

z means four zero bytes only at a group boundary. Tools that expand it anywhere shift every following byte and still report success.

A truncated tail of a single character cannot be decoded. Tools that pad it anyway return plausible bytes that were never in the input.

Frequently asked questions

Is Ascii85 the same as Base85 or Z85?

No. Ascii85 (the Adobe variant) maps four bytes onto five characters in the range ! to u and allows a single z for four zero bytes. Z85 uses a different alphabet, requires the input length to be a multiple of four and has no z. Base85 is a family name; this tool implements the Adobe variant and says so rather than guessing.

Why does my string start with <~ and end with ~>?

That is the Adobe wrapper used by PostScript and by btoa. It is not part of the data. This tool accepts it on input and can add it on output, but the bare string is what most program APIs expect.

How much larger is Ascii85 than Base64?

Ascii85 costs 25 percent over the raw bytes, because four bytes become five characters. Base64 costs 33 percent, because three bytes become four. That difference is the reason PDF and PostScript chose Ascii85 for embedded streams.

What does a single z mean, and why is it sometimes an error?

It stands for four zero bytes. Only at a boundary between groups does it mean that; inside a group it would change how every later character is aligned, so this tool reports it as an invalid character instead of expanding it.

Other tools