How to use the ascii85 encoder and decoder
- Choose Encode or Decode.
- To encode, type or paste text, or choose Hex bytes and enter bytes such as 4d 61 6e 20. Tick the box to wrap the result in the Adobe markers.
- To decode, paste Ascii85 text. Spaces, line breaks and the markers are ignored.
- Read the result, the number of bytes, the length of the encoding and the bytes as hex.
Formula
every 4 bytes = one number from 0 to 4,294,967,295 (base 256, first byte most significant)
the number written as 5 digits in base 85, each shown as the character with code 33 + digit
four zero bytes are written as the single letter z
a final group of n bytes is padded with zeros and written as n + 1 characters
The characters run from ! (digit 0) to u (digit 84). Decoding pads a short final group with the highest digit, u, and keeps n - 1 bytes.
The bytes of "Man "
The four bytes 4d 61 6e 20 make the number 1,298,230,816. Divided into base 85 digits, they are 24, 73, 80, 78 and 61, which become the characters 9, j, q, o and ^, so "Man " encodes to 9jqo^. With the Adobe wrapper it is <~9jqo^~>.
Four zero bytes encode to the single letter z, and the eight bytes 00000000 00000001 encode to z!!!!". Decoding 9jqo^ returns the four bytes and the text "Man ". The output is five characters for four bytes, so Ascii85 grows data by 25%, less than the 33% growth of Base64.
Where Ascii85 is used
Ascii85 packs binary data into printable text more densely than Base64. It appears in PostScript and PDF streams and in some developer tools. It comes in variants, and this page follows the Adobe form with the z shortcut and without the y shortcut for spaces. A different variant, such as Z85 or the RFC 1924 alphabet, uses other characters.
Not encryption
The encoding changes how bytes look, not who can read them. Anyone can decode the text. Do not use it to hide a secret. For related encodings, see the Base64 Encoder and Decoder, the Base32 Encoder and Decoder and the Base58 Encoder and Decoder. Everything runs in your browser and nothing is uploaded.
Assumptions and limits
- Text is converted to bytes as UTF-8 before encoding, and decoded bytes are shown as text when they are valid UTF-8.
- Input is limited to 200,000 characters.
- The y abbreviation and other variants are not accepted.
- Nothing is sent from your device.
Frequently asked questions
Why does the output sometimes include the letter z?
A group of four zero bytes is written as z instead of five exclamation marks. It is a space saver in the Adobe form and is expanded back when you decode.
What are the <~ and ~> markers?
They mark the start and end of Ascii85 data in PostScript and PDF. The page can add them when encoding and ignores them when decoding.
Why did decoding fail?
The text may include a character outside the range ! to u, a lone leftover character at the end, or a group whose value is too large for four bytes. The message names the problem.
How is Ascii85 different from Base64?
Base64 uses 64 characters and grows data by one third. Ascii85 uses 85 characters and grows data by one quarter, but includes characters that need care in some text formats.