1. Home
  2. Developer tools
  3. Ascii85 Encoder

Ascii85 Encoder

Ascii85 packs four bytes into five printable characters, so it is only 25% bigger than the input against 33% for Base64. Choose the Adobe variant found in PDF and PostScript streams, or Z85 for protocols that need a quote-safe alphabet.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Ascii85 Encoder

  1. Choose encode or decode and the variant.
  2. Paste text or hex bytes, or an Ascii85 block.
  3. Copy the result; Adobe output can include the <~ ~> markers.

Features

  • Adobe Ascii85 with optional <~ ~> delimiters
  • Z85 alphabet from the ZeroMQ specification
  • The z shortcut for four zero bytes
  • Handles a short final group correctly
  • Reports illegal characters with position
  • Shows size compared with Base64

Supported formats

Input

  • Typed or pasted text

You get

  • Ascii85
  • Z85

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Ascii85 Encoder is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Output is not wrapped into lines; add line breaks yourself if a format needs them.
  • Z85 encodes whole 4-byte groups only, as its specification requires.

Guide

Ascii85 and Z85: binary data at 25 percent overhead

Base64 is everywhere, but it spends four characters on every three bytes, a one-third overhead. Ascii85, also called Base85, spends five characters on four bytes, which is one quarter. The saving is modest and the alphabet is bigger, so it is chosen where compactness matters and the text channel can take punctuation: PDF and PostScript files and a few binary protocols.

How it works

Take four bytes and read them as one 32-bit number. Divide it by 85 five times, collecting the remainders, and add each remainder to 33 to get a printable ASCII character between ! and u. Because 85 to the fifth power is bigger than 2 to the 32nd, five characters are always enough. In the Adobe variant, a group of four zero bytes is written as the single letter z instead of !!!!!, which makes data with many zeros shorter still.

Delimiters and the short group

PostScript and PDF wrap the data in <~ and ~>, with the closing marker also telling the decoder where the stream ends. The page can add and remove them. When the input length is not a multiple of four, the last group is padded with zeros before encoding and then trimmed, so n leftover bytes give n + 1 characters. The decoder pads a short group with u characters, which is the highest digit, and drops the extra bytes.

The Z85 variant

Z85, defined in ZeroMQ’s RFC 32, uses an alphabet of 85 characters picked to be safe inside source code: it leaves out the quote marks, the backslash and the grave accent. It has no z shortcut and no delimiters, and it requires the input to be a multiple of four bytes, which suits keys and fixed-size blocks. The Z85 option on the page enforces this and says so when the length is wrong.

Using the page

Choose encode or decode, select Ascii85 or Z85, and pick whether the input is text or hex. For Adobe output you can switch the <~ ~> wrapper on. The page shows how many bytes went in and how many characters came out, so you can see the overhead for yourself. A character outside the alphabet is reported with its position, and so is a group that would give a value too large for 32 bits.

A worked example

The classic example is the four characters “Man ” (with a space), the bytes 4D 61 6E 20. Read as a 32-bit number that is 1,298,230,816. Converted to base 85 it has the five digits 24, 73, 80, 78 and 61, and adding 33 to each gives the characters 9, j, q, o and ^. The encoding of “Man ” is therefore 9jqo^. A longer text from the Sample button gives 55 characters for 44 bytes, exactly one quarter more.

Limits

Ascii85 is an encoding, not a cipher, and it does not compress; the output is larger than the input. The Adobe form is not safe in every text context, because it can contain quotes, backslashes and angle brackets, so check the channel before using it. The page does not wrap output into lines of a fixed width; add line breaks yourself if a format requires them. Variants such as the btoa form of Ascii85 and RFC 1924 are not included.

Checked against the current version of the Ascii85 Encoder on .

Frequently asked questions

How is a final group of fewer than four bytes handled in Ascii85?

It is padded with zero bytes, encoded, and then the same number of padding characters is cut from the end. A group of n bytes gives n + 1 characters. The decoder reverses this by padding with the highest character, u, and dropping the extra bytes.

Why would a project choose Z85 over the Adobe form?

Z85 avoids the quote, backslash and a few other characters that need escaping in source code and configuration files, so an encoded blob can be pasted into a string literal as it is. The price is that it only accepts data in whole four-byte groups.

How much smaller is it than Base64?

Four input bytes become five characters, a 25% increase, while Base64 turns three bytes into four characters, a 33% increase.

What does the letter z mean?

In the Adobe variant a single z stands for a group of four zero bytes, which saves space in data with many zeros. Z85 has no such shortcut.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.