How to use the ascii85 encoder decoder
- Select Encode or Decode from the mode dropdown.
- Choose the variant: Adobe for PostScript and PDF compatibility, or Plain for the same characters without the delimiters.
- Type or paste your text into the input area.
- The result updates automatically as you type.
How Ascii85 encoding works
An ascii85 encoder groups input bytes into blocks of four (32 bits). Each block is treated as a big-endian unsigned integer and converted to base 85 by repeatedly dividing by 85 and collecting the remainders. The five resulting digits are mapped to printable ASCII characters by adding 33, which corresponds to the exclamation mark character. This means the output alphabet spans from ! (ASCII 33) to u (ASCII 117).
If the final block has fewer than four bytes, it is padded with zero bytes before encoding. The encoder then outputs only as many characters as there were original bytes plus one, discarding the padding characters. For example, encoding the word "Man" (three bytes) produces four encoded characters instead of five.
The zero-block shortcut
A block of four zero bytes would normally encode as !!!!!. To save space, the Ascii85 specification defines a special shorthand: the single character z represents four zero bytes. An ascii85 encoder applies this substitution automatically whenever it encounters a full block of zeros. During decoding, a z is expanded back into four null bytes. Note that z can only be used for complete four-byte blocks; if the input ends with fewer than four zero bytes, they are encoded normally without the z shortcut.
Adobe versus plain output
The two options differ only in framing. The Adobe form wraps the encoded characters in <~ and ~>, the delimiters used in PostScript and PDF streams. Plain output is the same characters without the markers, which is what Python's base64.a85encode returns by default. The decoder accepts either form: it strips the delimiters when they are present and ignores whitespace anywhere in the data.
What this tool does not support: the older Unix btoa format with its checksum trailer and its y shorthand for four spaces, the Z85 alphabet used by ZeroMQ, and the RFC 1924 alphabet for IPv6 addresses. Those are different Base85 variants and will not decode here. Text is encoded as UTF-8; if decoded bytes are not valid UTF-8 (for example a compressed PDF stream), the result is shown as hex bytes instead.
Efficiency compared to Base64
Base64 encodes three bytes into four characters, yielding an expansion ratio of about 1.33. Ascii85 encodes four bytes into five characters, giving a ratio of 1.25. This means Ascii85 output is roughly 6 percent smaller than Base64 output for the same binary data. In documents where embedded binary streams are large, such as images inside a PDF, that reduction translates to noticeably smaller file sizes.
| Encoding | Bytes in | Chars out | Ratio |
|---|---|---|---|
| Base64 | 3 | 4 | 1.333 |
| Ascii85 | 4 | 5 | 1.250 |
Common mistakes when decoding
Decoding fails most often because of whitespace handling or missing delimiters. The Ascii85 specification allows spaces, tabs, and newlines anywhere inside the encoded data, and a robust decoder ignores them. Another common issue is passing Adobe-framed data to a decoder expecting raw Base85 without delimiters. If your input comes from a PDF stream, it likely includes the <~ and ~> markers; make sure the variant is set to Adobe so the decoder strips them correctly.
Finally, invalid characters outside the range ! to u (and the special z) will cause an error. Check that no stray punctuation or line-number artifacts have been pasted into the input field.
Worked examples
| Example | Input | Result |
|---|---|---|
| Encode 'Hello' | Mode: encode; Variant: adobe; Input: Hello | <~87cURDZ~> |
| Decode an Adobe string | Mode: decode; Variant: adobe; Input: <~87cURD]j7BEbo80~> | Hello world! |
| Four zero bytes become z | Mode: encode; Variant: adobe; Input: | <~z~> |
| Plain output | Mode: encode; Variant: plain; Input: Man is distinguished | 9jqo^BlbD-BleB1DJ+*+F(f,q |
FAQ
What is an ascii85 encoder used for?
It converts binary data into printable ASCII text so it can be safely embedded in text-based formats like PostScript and PDF. It is more space-efficient than Base64.
Is Ascii85 the same as Base85?
Ascii85 is the best-known Base85 scheme, but not the only one. Z85 and the RFC 1924 alphabet are also called Base85 and use different characters, so their output does not decode as Ascii85.
Why does my encoded output contain the letter z?
The character z is a special shorthand representing four consecutive zero bytes. It saves space compared to writing out five exclamation marks.
Can I use this tool to decode PDF streams?
Yes. Select the Adobe variant and paste the stream, with or without the <~ and ~> markers. The decoder handles whitespace and partial trailing groups. Streams that were also compressed (for example with Flate) must be decompressed separately, and non-text bytes are shown as hex.
Does this tool upload my data?
No. All encoding and decoding happens locally in your browser. Nothing is sent to any server.
What is the difference between the Adobe and plain options?
They use the same encoding. Adobe wraps the result in <~ and ~> as PDF and PostScript do, while plain returns only the encoded characters.