ASCII85 (Base85) Encoder/Decoder
NewEncode and decode text using ASCII85, the compact binary-to-text encoding used in Adobe PostScript/PDF and Git binary patches — roughly 25% more space-efficient than Base64.
Frequently Asked Questions
How is ASCII85 different from Base64?
Base64 encodes 3 bytes into 4 characters (a 33% size increase), while ASCII85 encodes 4 bytes into 5 characters (a 25% size increase) — making ASCII85 noticeably more space-efficient, at the cost of using a wider, less URL-safe character set.
Where is ASCII85 actually used?
It's the standard binary-to-text encoding inside PostScript and PDF files (for embedding images and fonts as text), and Git also uses a base85 variant when generating binary patches with `git diff --binary`.
What does the special "z" shortcut do?
A run of four all-zero bytes — common in image data with large blank/transparent regions — is compressed to a single "z" character instead of the usual 5-character group, saving significant space in sparse binary data.
Can ASCII85 output be safely used in a URL?
Not directly — ASCII85 uses characters like `', <, >, and space that need escaping in URLs, unlike Base64URL's specifically URL-safe character set. Use Base64 or Base64URL encoding if the output needs to go directly into a URL.