🔢 Base85 Encoder – ASCII85, Z85 & RFC 1924 Online Tool
Base85 encoding (also known as ASCII85) is a binary-to-text encoding scheme that represents binary data using 85 printable ASCII characters. Unlike Base64 which maps every 3 bytes to 4 characters (33% overhead), Base85 maps every 4 bytes to 5 characters — achieving roughly 25% overhead and making its output approximately 20% smaller than equivalent Base64 output.
How Base85 Encoding Works
The encoding process works by treating each group of 4 input bytes as a 32-bit unsigned integer. That integer is then expressed as a 5-digit number in base 85, with each digit mapped to a printable ASCII character from the chosen character set.
For example, in the ASCII85 (Adobe/PostScript) variant, the encoding uses characters from ! (ASCII 33) through u (ASCII 117). The output is wrapped in <~ and ~> delimiters as defined by the Adobe standard. A special optimization applies: any 4-byte block that is all zeros is encoded as the single character z instead of !!!!!, saving 4 characters per null block.
The Three Supported Variants
ASCII85 (Adobe)
The classic variant from Adobe PostScript and PDF. Uses characters ! to u (ASCII 33–117). Wraps output in <~ ~> delimiters. Supports partial final blocks and zero-block compression with z.
Z85 (ZeroMQ)
Used by the ZeroMQ messaging library. Employs an alphanumeric-first character set: 0–9, a–z, A–Z, and a set of symbols. URL-friendly. Requires input byte count to be a multiple of 4.
RFC 1924
Defined in RFC 1924 for compact IPv6 address representation. Uses digits, uppercase letters, lowercase letters, and a set of additional symbols. Often used for representing large integers or IPv6 addresses in compact form.
Base85 vs Base64 vs Base16
To understand why Base85 is preferred in certain scenarios, consider encoding 100 bytes of binary data:
- Base16 (Hex): 200 characters — 100% overhead
- Base64: ~136 characters — ~33% overhead
- Base85: ~125 characters — ~25% overhead
The size difference becomes significant at scale. For a 1 MB binary file, Base85 saves roughly 85 KB compared to Base64 — meaningful in PDF file streams, Git binary patches, or network protocol payloads where every byte counts.
Real-World Applications
PDF and PostScript Streams
Adobe Systems defined ASCII85 as the standard encoding for binary data streams in PDF and PostScript files. Image data, fonts, and compressed streams are routinely encoded this way to keep the file in a text-safe format.
Git Binary Patches
Git uses a variant of Base85 when generating binary patches (git format-patch with binary files). This ensures binary diffs can be shared as plain-text email or stored in text-based systems without corruption.
ZeroMQ (Z85)
The ZeroMQ messaging library uses the Z85 variant for encoding binary keys and security tokens in a URL-safe, shell-safe format. Z85's character set is designed to be safe across all common systems and protocols.
Input Modes: Plain Text and Hex
This tool supports two input modes:
- Plain Text: Enter any UTF-8 text and it will be encoded by converting each character to its byte representation first.
- Hex String: Provide raw byte values as a hexadecimal string (e.g.,
48656C6C6F) to encode exact byte sequences. Spaces and colons are automatically stripped.
Line Wrapping
Long Base85 strings can be hard to embed in source code, email bodies, or document comments. The line wrap option splits the output at a configurable column width (commonly 76 or 80 characters), making it easy to paste into any context without breaking formatting.
Tips for Using This Tool
- Use ASCII85 for general-purpose encoding — it's the most widely supported variant and handles any input length.
- Use Z85 when working with ZeroMQ or when you need a URL-safe character set — but ensure your input is a multiple of 4 bytes.
- Use RFC 1924 for compact IPv6 address representation or when interoperating with systems that expect that character set.
- Enable Auto Encode to see the result update in real time as you type.
- Download the encoded output as a
.txtfile for easy integration into other workflows.