Ascii85 Encoder and Decoder

Convert text, hex bytes or files to Ascii85, the Base85 variant used in PostScript and PDF, and back. Add Adobe delimiters or wrap long output into lines.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Choose Encode to turn text or bytes into Ascii85, or Decode to turn Ascii85 back into data.
  2. Turn on Adobe delimiters if the output goes into PostScript or must match Python a85encode with adobe=True.
  3. Optionally set a line wrap so long output is split into lines.
  4. Type, paste or open a file, then copy or download the result. When decoding, delimiters, spaces and line breaks are ignored.

What is Ascii85?

Ascii85 reads the input 4 bytes at a time, treats each group as a 32-bit number and writes it as 5 base-85 digits. The digits are the 85 consecutive ASCII characters from ! (code 33) to u (code 117): each character is simply the digit value plus 33. The output is 25% larger than the input, against 33% for Base64.

The format was first used by the Unix btoa utility. Adobe adopted it as the ASCII base-85 encoding of PostScript Level 2 and PDF, where it lets binary data such as images and fonts travel inside a plain text file. Python offers it as base64.a85encode() and Go as the encoding/ascii85 package.

The z shortcut and the Adobe delimiters

A group of four zero bytes would normally be written as five exclamation marks. Ascii85 writes it as a single z instead, which keeps runs of empty data short. The shortcut applies only to complete groups. When the input length is not a multiple of 4, the final group of n bytes becomes n + 1 characters and is never abbreviated.

PostScript marks an Ascii85 string with <~ at the start and ~> at the end. In a PDF stream with the ASCII85Decode filter, only the closing ~> is used, as an end-of-data marker. The decoder here removes either delimiter when present and ignores whitespace, so you can paste stream data from a PDF or PostScript file directly.

Ascii85 in code

# Python 3.4+
import base64
base64.a85encode(b'hello')                      # b'BOu!rDZ'
base64.a85encode(b'hello', adobe=True)          # b'<~BOu!rDZ~>'
base64.a85decode(b'<~BOu!rDZ~>', adobe=True)    # b'hello'

// Go
import "encoding/ascii85"
dst := make([]byte, ascii85.MaxEncodedLen(len(src)))
n := ascii85.Encode(dst, src)

Specification

AlphabetASCII 33 (!) to 117 (u), plus z
Output size5 characters per 4 bytes (125%)
PaddingNone, optional <~ ~> delimiters
StandardAdobe PostScript and PDF
Case sensitiveYes

Examples

Input (UTF-8)Output
Hello, World!87cURD_*#4DfTZ)+T
Base64.is6=FqH2Dd%#Er
你好jLq5JV7c

Frequently asked questions

What is the difference between Ascii85 and Base85?
Both encode 4 bytes as 5 characters, but with different alphabets. Ascii85 uses the range from ! to u and has the z shortcut. The Base85 page uses the RFC 1924 alphabet of Git and Python b85encode, and Z85 is the ZeroMQ variant.
Why does my output contain the letter z?
Each z stands for four zero bytes in a complete group. Decoders expand it back automatically, so the data is unchanged.
Do I need the Adobe delimiters?

Only if the program reading the data expects them, for example a PostScript interpreter or Python a85decode with adobe=True. Many tools accept Ascii85 without them. When decoding here, delimiters are optional.

Can I decode an ASCII85 stream from a PDF?

Yes. Paste the stream data and choose Hex output or download the result. If the stream lists FlateDecode after ASCII85Decode in its filters, the decoded bytes are still zlib-compressed and need a second step.

Why do I get an invalid character error?
Ascii85 only allows the characters from ! to u, plus z between groups. The y abbreviation for four spaces, used by some btoa versions and by Python with foldspaces=True, is not part of the Adobe format and is rejected.