Base85 to Text Converter
Decode Base85 encoded strings to readable text. Supports ASCII85 (Adobe btoa), Z85 (ZeroMQ), and RFC 1924 encoding variants.
About
Base85 encoding maps 4 binary bytes to 5 printable ASCII characters, achieving roughly 25% overhead versus the 33% of Base64. Three major variants exist: ASCII85 (used in Adobe PostScript and PDF streams, wrapped in <~ and ~> delimiters), Z85 (designed by ZeroMQ to be safe inside quoted strings), and RFC 1924 (proposed for compact IPv6 representation). Each variant uses a distinct 85-character alphabet, so feeding data encoded in one variant into a decoder configured for another produces garbage or fails silently. This tool validates input against the selected alphabet before decoding and reports exact character positions of any violations.
The decoding math is identical across variants: a group of 5 encoded characters is treated as a base-85 number, converted to a 32-bit unsigned integer, then split into 4 output bytes. Final groups shorter than 5 characters are right-padded with the highest alphabet character (u for ASCII85, % for Z85) before conversion, and excess output bytes are trimmed. ASCII85 also defines a special z shortcut representing four zero bytes. Incorrect padding or stray whitespace in the input are the most common sources of corrupted output. This converter strips whitespace and optional delimiters automatically, but preserves your data integrity by refusing to silently skip invalid characters.
Formulas
Each group of 5 encoded characters is decoded into 4 binary bytes using positional base-85 arithmetic:
where ci is the index of the i-th character in the variant's 85-character alphabet. The resulting 32-bit unsigned integer is then split into 4 bytes (big-endian):
byte1 = (value >> 16) & 0xFF
byte2 = (value >> 8) & 0xFF
byte3 = value & 0xFF
For a final group with n encoded characters where 2 ≤ n < 5, the group is right-padded to length 5 with the highest-value alphabet character (index 84). After decoding, only n − 1 output bytes are kept. The maximum decodable 32-bit value is 855 − 1 = 4,437,053,124, which exceeds 232 − 1 = 4,294,967,295. Any group decoding to a value above 232 − 1 is an encoding error.
Reference Data
| Property | ASCII85 (Adobe) | Z85 (ZeroMQ) | RFC 1924 |
|---|---|---|---|
| Alphabet Range | ! to u (0x21-0x75) | 0-9, a-z, A-Z, .-:+=^!/*?&<>()[]{}@%$# | 0-9, A-Z, a-z, !#$%&()*+-;<=>?@^_`{|}~ |
| Alphabet Size | 85 | 85 | 85 |
| Encoded Group Size | 5 chars | 5 chars | 5 chars |
| Decoded Group Size | 4 bytes | 4 bytes | 4 bytes |
| Overhead vs Raw Binary | 25% | 25% | 25% |
| Overhead of Base64 | 33% | 33% | 33% |
| Space Savings over Base64 | ≈ 6.7% | ≈ 6.7% | ≈ 6.7% |
| Zero-block Shortcut | z → 4×0x00 | None | None |
| Delimiters | <~ ... ~> | None | None |
| Whitespace Handling | Ignored between delimiters | Not allowed | Not allowed |
| Padding Character | u (value 84) | % (value 84) | ~ (value 84) |
| Max 32-bit Value Encoded | 4,294,967,295 (855 − 1) | 4,294,967,295 | 4,294,967,295 |
| Common Use Case | PDF, PostScript streams | ZeroMQ binary frames | IPv6 address encoding |
| Specification | Adobe PostScript Ref. Manual | ZeroMQ RFC 32 | RFC 1924 (April 1996) |
| String-Safe (No Quotes) | No (contains ' and ") | Yes | No |
| URL-Safe | No | No | No |