1001Ferramentas
📤 Utilities

Base85 / ASCII85 Encoder

Encode text in ASCII85 (Adobe/btoa) using 85 printable characters. Denser than Base64: every 4 bytes becomes 5 ASCII characters.

Ascii85: when every character counts

Ascii85 encodes four bytes into five characters, against base64's four for three. In practice that means 25 per cent growth instead of 33 — it sounds small, but in a PostScript file or a PDF stream, where binary data lives embedded in text, the difference shows in the final size. The price is a wider alphabet, including punctuation that gets in the way inside URLs.

Type the text and get the encoding in the Adobe variant, wrapped in opening and closing markers. The maths treats each group of four bytes as a 32-bit number and writes it in base 85, starting at the exclamation mark. There is one shortcut: a whole group of zeros becomes a lone letter z, saving four characters in data with plenty of empty space.

The final group, when it does not hold four full bytes, is padded with zeros and then truncated — it comes out one character longer than the real byte count, which is how the decoder knows how many bytes to recover. Check against a known example: the text "Man " encodes to 9jqo^, and "sure." to F*2M7/c. Outside PDF and PostScript, Ascii85 rarely turns up: base64 won by being safe in more places.

Frequently asked questions

What are the markers at the start and end for?
They mark where the encoded block begins and ends, a convention Adobe adopted for embedding data in PostScript. Not every variant uses them — Git's btoa version, for instance, has a different alphabet and leaves them out. If the destination complains, drop them.
Can I use Ascii85 in a URL?
Not without escaping. The alphabet includes characters such as slash, plus, question mark and ampersand, all with special meaning in a URL. For that case, base64url or base58 are better choices.
Why 85 and not some other number?
Because 85 is the smallest integer whose fifth power exceeds 2 to the 32. Since four bytes form a number up to 2 to the 32 minus one, five digits of the chosen base have to cover that range — 84 to the fifth does not, 85 does.

Related Tools