Ascii85 encoder and decoder — Adobe Base85 for PDF and PostScript

Encode text as Ascii85, the Base85 format Adobe uses in PostScript and PDF, or decode an Ascii85 block. Delimiters, line breaks and the z shortcut for zero bytes are handled.

Live demo · real result from this tool
Direction

Encoded

9jqo^BlbD-BleB1DJ+*+F(f,q

Processed on your device — nothing is uploaded.

How to use the Ascii85 tool

  1. Set Direction to Encode or Decode.
  2. Paste your text, or the Ascii85 block, into Input. When decoding, line breaks and the <~ ~> marks are fine.
  3. When encoding, tick Wrap in <~ ~> (PostScript/PDF) if the output goes into a PostScript or PDF file.
  4. Copy the Encoded or Decoded result.

What it does and when to use it

Ascii85, also called Base85, was developed for the btoa tool and adopted by Adobe for PostScript and PDF. In a PDF, a stream can carry the filter /ASCII85Decode, which means its content is Ascii85 text that must be decoded before use. Decoding such a block here shows what is inside, often further compressed data rather than readable text.

Use the encoder to embed small amounts of data in a text-only format with less overhead than Base64, or to produce test data for a parser. Ascii85 is an encoding, not encryption, and offers no secrecy.

For a version that is safe in source code and JSON strings, use Z85. For URL-safe output, Base64URL is the better choice. To see the bytes of a decoded result, the hex dump viewer shows every byte.

How it works

  1. Text becomes UTF-8 bytes, read four at a time as a 32-bit number.
  2. The number is written as five base-85 digits, most significant first. Each digit d becomes the character with code 33 + d, so 0 is ! and 84 is u.
  3. A full group of four zero bytes is written as z.
  4. A last group of 1 to 3 bytes is padded with zeros, encoded, and cut to bytes + 1 characters.

Decoding removes whitespace and delimiters, expands z, and pads a short final group with u before converting back, then drops the padding bytes. The tool runs in your browser.

Worked examples

Man is distinguished           →  9jqo^BlbD-BleB1DJ+*+F(f,q
Hello World  (with <~ ~>)      →  <~87cURD]i,"Ebo7~>
<~87cURD]i,"Ebo80~>  (Decode)  →  Hello World!
sure.                          →  F*2M7/c

“Man is distinguished” and “sure.” are the classic examples used to explain Ascii85. “sure.” is 5 bytes: one full group of 5 characters, then 1 leftover byte that needs 2 characters, 7 in total. Compare the second and third lines: adding “!” to “Hello World” changes only the last group.

Limits and tips

  • Text is encoded as UTF-8. Decoded bytes that are not valid UTF-8, common for PDF streams, are shown as hex.
  • The y shortcut for four spaces, used by some btoa versions, is not supported.
  • A final group of a single character is invalid and is reported as an error.

Frequently asked questions

How much bigger does Ascii85 make my data?
Every 4 bytes become 5 characters, so the output is 25% larger than the input. Base64 adds about 33%, which is why Ascii85 was used where space mattered, such as in PostScript and PDF files.
What are the <~ and ~> marks?
They are Adobe's start and end delimiters for an Ascii85 block. PostScript and PDF expect at least the ~> end marker. Tick "Wrap in <~ ~>" to add both when encoding. When decoding, they are optional and removed if present.
What does a z in the output mean?
z is a shortcut for four zero bytes in a row. Instead of writing !!!!!, the encoder writes a single z. It only appears for a complete group of four zeros, not for a shorter group at the end.
Is Ascii85 the same as Z85?
No. Both pack 4 bytes into 5 characters, but they use different alphabets. Ascii85 uses the characters ! to u, which include quotes and backslashes, while Z85 uses a set chosen to be safe inside source code strings. Their output is not interchangeable.
Why does decoding fail on a v or w?
The Ascii85 alphabet stops at u, the 85th character after !. Letters v to y (and any character outside ! to u, except z) mean the input is not Ascii85 or was damaged. The error gives the position.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close