Skip to content

↑↓ navigate ↵ open Esc close Search runs locally

Base85 / Ascii85 Encode & Decode Online

Encode and decode Base85 in the Ascii85 (Adobe and btoa) and Z85 (ZeroMQ) variants. The most compact text encoding in common use, about 25% overhead.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
0 BUTF-8
Base85
Runs in your browser. Nothing is uploaded. Tip: drop a file onto the left box

How to use the Base85 / Ascii85 tool#

  1. Choose Encode or Decode at the top of the tool.
  2. Pick the Variant: Ascii85 with Adobe <~ ~> delimiters (PDF, PostScript), Ascii85 without delimiters, or Z85 (ZeroMQ).
  3. Type or paste into the left box. When decoding Adobe Ascii85, the <~ and ~> markers and any line breaks are handled automatically.
  4. Copy or download the result. For Z85, the input must be a multiple of 4 bytes.

Examples#

The classic Ascii85 example

Input
Man 
Output
<~9jqo^~>

The 4 bytes of "Man " (with the trailing space) become 5 characters between the Adobe markers.

Decode Ascii85

Input
<~87cURDZ~>
Output
Hello

5 bytes: one full group of 4 (87cUR) and a final group of 1 byte, written with 2 characters (DZ).

Encode with Z85

Input
Hi!!
Output
nnfj<

Z85 needs the input to be a multiple of 4 bytes, and uses a different alphabet from Ascii85.

What is Base85?#

Base85 encodes every 4 bytes of data as 5 printable characters, using 85 different symbols. That adds only 25% to the size, compared with 33% for Base64 and 100% for hex. The price is a larger alphabet that includes punctuation such as ", ', \ and <, so Base85 needs care in JSON, XML, URLs and shell commands.

There is no single Base85. The common variants share the 4-bytes-to-5-characters idea but use different alphabets and rules: Ascii85 (Adobe, btoa), Z85 (ZeroMQ) and the alphabet used by Git and RFC 1924.

How Base85 works#

Take 4 bytes as one 32-bit number, then write it as 5 base-85 digits. 855 = 4,437,053,125 is just above 232 = 4,294,967,296, so 5 digits always fit:

StepValue for Man
Bytes4d 61 6e 20
32-bit number1,298,230,816
Base-85 digits24, 73, 80, 78, 61
Ascii85 (digit + 33)9 j q o ^

In Ascii85, each digit is written as the ASCII character with code digit + 33, so the alphabet runs from ! (33) to u (117).

Ascii85 rules#

  • z for zeros: a group of four zero bytes is written as a single z instead of !!!!!. This only applies to whole groups.
  • Short final group: if the input does not end on a 4-byte boundary, it is padded with zeros, encoded, and only the first n + 1 characters are kept for n leftover bytes.
  • Adobe delimiters: PostScript and PDF wrap the data in <~ and ~>. Whitespace inside is ignored.

Base85 variants#

VariantAlphabetNotesUsed by
Ascii85 (Adobe)! to u<~ ~> markers, z for zerosPDF, PostScript
Ascii85 (btoa)! to uNo markers; the original btoa tool also used y for four spacesOld Unix tools
Z850–9 a–z A–Z + .-:+=^!/*?&<>()[]{}@%$#Input must be a multiple of 4 bytes; avoids quotes and backslashZeroMQ, CurveZMQ keys
RFC 1924 / Git0–9 A–Z a–z + !#$%&()*+-;<=>?@^_`{|}~Different alphabet from Ascii85git diff --binary, Python b85encode

Z85 was designed to be safe inside source code strings: it leaves out ", ' and \. Its specification is ZeroMQ RFC 32, which also gives the reference example: the 8 bytes 86 4F D2 6F B5 59 F7 5B encode to the string HelloWorld.

When to use Base85#

  • PDF and PostScript streams with the ASCII85Decode filter.
  • ZeroMQ: CurveZMQ public and secret keys are 32 bytes, written as 40 Z85 characters.
  • Git binary patches, which use the RFC 1924 alphabet.
  • Size-sensitive text channels, where saving 8% over Base64 matters and the extra punctuation is not a problem.

For JSON, URLs and HTTP headers, Base64 or Base64URL are usually the safer choice, because Base85 output can contain characters that need escaping there.

Base85 in code#

Python#

python
import base64 base64.a85encode(b'Man ')                 # b'9jqo^'base64.a85encode(b'Man ', adobe=True)     # b'<~9jqo^~>'base64.a85decode(b'<~87cURDZ~>', adobe=True)   # b'Hello' base64.b85encode(b'Hello')   # RFC 1924 / Git alphabet (not Ascii85)base64.z85encode(b'Hi!!')    # Python 3.13+: b'nnfj<'

Command line#

bash
# GNU coreutils basenc supports Z85echo -n 'Hi!!' | basenc --z85      # nnfj<

Common errors and fixes#

  • "Not a valid Ascii85 character"

    Ascii85 only uses characters from ! to u, plus z. Letters v to y, {, |, } and ~ (outside the ~> marker) mean the value is a different variant, often Z85 or the Git alphabet. Switch the Variant option.

  • "z can only stand for a whole group"

    A z appeared in the middle of a 5-character group. In Ascii85, z is a shortcut for four zero bytes and is only valid between groups. The data is probably not Ascii85, or it was damaged.

  • "Z85 only encodes data whose length is a multiple of 4 bytes"

    Z85 has no padding rule. Pad the input to a multiple of 4 bytes before encoding (and remember to strip the padding after decoding), or use Ascii85, which handles any length.

  • Python b85decode fails on data from a PDF

    b85decode uses the RFC 1924 alphabet. PDF and PostScript use Ascii85, so call base64.a85decode(data, adobe=True) instead.

  • Base85 data breaks inside JSON, XML or a shell command

    Ascii85 can contain ", \, < and &, which those formats treat specially. Escape the value, use Z85 (no quotes or backslash), or switch to Base64.

Frequently asked questions#

Is Base85 the same as Ascii85?

Ascii85 is the most common Base85 variant. "Base85" is the general idea (4 bytes into 5 characters); Ascii85, Z85 and the Git/RFC 1924 alphabet are specific versions with different characters.

Why is Base85 smaller than Base64?

Base85 packs 4 bytes into 5 characters (25% overhead), while Base64 packs 3 bytes into 4 characters (33% overhead). The bigger alphabet carries more information per character.

What do <~ and ~> mean?

They are the start and end markers Adobe uses for Ascii85 in PostScript and PDF. The data is only what sits between them.

Which variant should I use?

Use Adobe Ascii85 for PDF or PostScript, Z85 for ZeroMQ or when the result goes into source code, and Base64 for web APIs, JSON and URLs.

Is my data uploaded?

No. Encoding and decoding run entirely in your browser.

Your next tool is one search away.

Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.

Browse all tools

Tip: press Ctrl D to bookmark dev247.