B85 ENC

Base85 Encoder / Decoder

Base85 Encoder / Decoder

Online Free Base85 Tool — ASCII85, Z85, RFC 1924 & Adobe Variants

Auto-convert

Drop file here

Chars: 0 | Bytes: 0
Chars: 0 | Overhead: 0%
Strip Whitespace from Input
Process Line by Line
Add Header Comment
Use 'z' shortcut for zero words
Use 'y' shortcut for space words (ASCII85)

Why Use Our Base85 Encoder / Decoder?

5 Variants

ASCII85, Z85, RFC 1924, Adobe & Python

25% Smaller

vs Base64's 33% overhead

Validation

Char-by-char analysis

File Mode

Any file type

Private

100% browser-based

Compare

vs Base64, Base32, Hex

The Complete Guide to Base85 Encoding and Decoding: ASCII85, Z85, RFC 1924 and Why Base85 Beats Base64 in Efficiency

In the world of data encoding, efficiency matters. When you need to represent binary data as printable text—whether for embedding in PDF documents, transmitting over protocols that require ASCII-safe data, compressing data in PostScript files, or creating compact network protocol payloads—the choice of encoding scheme has real consequences for the size and performance of your systems. Base85 is a family of encoding schemes that achieves notably better efficiency than the ubiquitous Base64, converting every 4 bytes of binary data into exactly 5 printable ASCII characters rather than Base64's conversion of every 3 bytes into 4 characters. Our free Base85 encoder decoder online supports all five major Base85 variants—ASCII85, Adobe ASCII85, RFC 1924, Z85, and Python base85—with advanced features including file encoding, batch processing, character-by-character validation, and a comprehensive comparison with Base64, Base32, Base58, and hexadecimal encoding, all running privately in your browser without any data ever leaving your device.

The mathematical elegance of Base85 lies in its relationship to the byte and the number 85. Consider the problem of encoding binary data as printable text: you want to use as many distinct printable characters as possible to maximize information density, but you must stay within the safe range of printable ASCII. The printable ASCII characters span from value 33 (!) to value 126 (~), giving 94 distinct characters. Using 85 of these characters enables a particularly efficient encoding because 85^5 = 4,437,053,125, which is greater than 256^4 = 4,294,967,296 (the number of possible 4-byte combinations). This means that any 4-byte group can be represented as exactly 5 base-85 digits, with no wasted capacity. In contrast, Base64 requires 4 characters for every 3 bytes (64^4 = 16,777,216 > 256^3 = 16,777,216, just barely), resulting in a 33.3% size overhead. Base85's 5 characters per 4 bytes gives exactly 25% overhead—a significant improvement for any application dealing with large amounts of binary data.

The History and Variants of Base85

The history of Base85 encoding is surprisingly rich, with multiple independent implementations developed over the decades for different contexts. The earliest well-known implementation is btoa/atob, developed in 1987 by Paul Rutter for the Unix-to-Unix copy system, which used a 85-character subset of printable ASCII. This early implementation did not handle the zero-word optimization and used a slightly different alphabet than later implementations.

The most widely deployed variant is ASCII85 (also called Base85), which was standardized by Adobe Systems for use in PostScript and later PDF documents. Adobe's implementation uses the ASCII characters from '!' (decimal 33) through 'u' (decimal 117), providing exactly 85 distinct characters numbered 0 through 84. A key optimization in ASCII85 is the 'z' shortcut: when an entire 4-byte group consists entirely of zero bytes (the value 0x00000000), it is encoded as a single 'z' character rather than the five-character sequence '!!!!!', dramatically compressing data that contains large runs of zeros such as null bytes in padded structures or blank areas in bitmap images. Some implementations also support a 'y' shortcut for groups consisting entirely of space bytes (0x20202020), though this is less commonly used.

The Adobe ASCII85 variant adds angle-bracket delimiters to the stream: the encoded data begins with "<~" and ends with "~>", allowing the decoder to unambiguously identify the beginning and end of a Base85-encoded block within a larger document. This delimiter convention is part of the PDF specification and is essential for correct parsing of PDF content streams. Our tool's Adobe variant correctly handles these delimiters in both encoding and decoding, making it fully compatible with PDF and PostScript processing tools.

RFC 1924, published in 1996 as an April Fools' Day joke but containing a genuinely useful encoding, defines a Base85 alphabet designed for encoding IPv6 addresses compactly. The RFC 1924 alphabet consists of the digits 0-9, followed by uppercase A-Z, then lowercase a-z, then the symbols !#$%&()*+-;<=>?@^_`{|}~. This ordering means that numbers encode to digit characters and shorter strings tend to look more natural. An IPv6 address (128 bits = 16 bytes) can be encoded as exactly 20 RFC 1924 Base85 characters. While RFC 1924 was never standardized, its alphabet and approach have influenced subsequent Base85 implementations.

Z85 (ZeroMQ Base-85) was designed specifically for the ZeroMQ messaging library as a format for encoding curve keys and other binary data for transport. Z85 defines its own 85-character alphabet: 0-9 followed by a-v followed by A-V, followed by selected punctuation. The key design constraint of Z85 is that it must be safe for embedding in C strings (no null bytes, no backslash sequences that could be misinterpreted), JSON, XML, and command-line arguments. Z85 does not implement the zero-word 'z' shortcut, and importantly it only operates on data whose length is a multiple of 4 bytes, padding if necessary. This constraint simplifies both encoding and decoding but requires callers to know the original data length.

Python's base85 module (added in Python 3.4) implements a variant based on the ASCII85 alphabet but without the zero-word shortcut and with slightly different padding behavior. When you call base64.b85encode() in Python (yes, despite the name it's in the base64 module), you get this Python-specific encoding. Understanding which variant your target system expects is critical, and our tool explicitly supports all five variants to eliminate ambiguity.

How Base85 Encoding Works: Step by Step

The encoding process for Base85 (specifically the ASCII85 variant) proceeds as follows. First, the input bytes are grouped into blocks of four bytes each. Each 4-byte block is interpreted as a 32-bit unsigned integer in big-endian byte order. This integer is then converted to base 85 by repeatedly dividing by 85 and collecting remainders: the five remainders become the five digits of the encoded group, from most-significant to least-significant. Each digit is then mapped to a character by adding 33 (the ASCII code of '!') to get characters in the range '!' to 'u'. This produces the 5-character encoded form of the 4-byte input group.

For the zero-word optimization, before performing the division, the encoder checks whether the 32-bit integer is exactly zero. If it is, the entire 5-character sequence would be '!!!!!' (five exclamation marks), and instead the single character 'z' is emitted. This optimization is particularly valuable for encoding PDF or PostScript data that contains large null-padded areas, where a sequence of zeros might compress to one-fifth its Base85 size.

Handling data whose length is not a multiple of 4 bytes requires special treatment. If there are 1, 2, or 3 remaining bytes, they are right-padded with null bytes to form a complete 4-byte block, encoded as usual to produce 5 characters, and then only 2, 3, or 4 of those 5 characters respectively are output. The decoder knows from the remaining character count how many bytes to extract from the final partial group. In Adobe ASCII85, the end of the data stream is also marked with a partial group followed by the "~>" terminator, which eliminates any ambiguity about stream boundaries.

Base85 vs. Base64: A Detailed Efficiency Comparison

The efficiency advantage of Base85 over Base64 is consistent and significant across all data sizes. For every 100 bytes of input, Base64 produces approximately 136 characters of output (the exact value is ceil(100/3)*4 = 136), while ASCII85 produces approximately 125 characters (ceil(100/4)*5 = 125). This represents a real-world improvement of about 8% in encoded output size when comparing Base85 to Base64. For large binary files—images, compressed archives, audio data—this difference can amount to megabytes of saved space or transferred data.

The efficiency comparison becomes even more favorable for Base85 when the zero-word optimization applies. Data containing many null bytes (such as sparse binary formats, padded structures, or zero-initialized memory regions) can see dramatic compression from the 'z' shortcut: a 4-byte null word that would be 6 bytes in Base64 (4 bytes → "AAAA==") becomes a single 'z' character in ASCII85. For highly zero-sparse data, this can reduce encoded size by factors of 5 or more compared to naive encoding.

However, Base64 has its own advantages that explain its dominance despite Base85's efficiency benefit. Base64 is universally implemented in almost every programming language and runtime environment—it's in the standard library of JavaScript, Python, Java, Ruby, PHP, Go, Rust, and virtually every other language. Base85, by contrast, requires importing a library or implementing the algorithm, which adds friction for developers. Additionally, Base64's simpler algorithm (table lookup per 6-bit group) is more cache-friendly and predictable than Base85's long-division arithmetic, making Base64 faster to encode and decode in typical implementations. For time-sensitive applications where CPU cost matters more than size, Base64 may still be the better choice despite producing larger output.

Practical Applications of Base85 Encoding

Understanding where Base85 is actually used helps contextualize its design choices. In the PDF specification, ASCII85 encoding is one of the two primary filters used for encoding binary stream content (the other being hexadecimal encoding). When you embed a JPEG image, a compressed content stream, or any other binary data in a PDF document, the PDF specification allows it to be stored as ASCII85 data, making the PDF file printable, readable, and transmittable as ASCII text. PDF readers universally implement ASCII85 decoding, making this a well-supported and stable use case. The 25% overhead of Base85 versus 33% for Base64 translates directly to smaller PDF files for documents with embedded images or compressed content.

In PostScript programming, ASCII85 is used extensively for similar reasons. PostScript printers and interpreters process streams of ASCII data, and binary raster data for images must be encoded in an ASCII-safe format. ASCII85 became standard because of its efficiency and the existence of the 'z' shortcut which dramatically reduces the size of image data containing large uniform regions.

The ZeroMQ library's use of Z85 encoding represents a modern application in high-performance messaging. ZeroMQ is a messaging library used in systems programming, financial trading systems, and distributed computing where performance is critical and every byte matters. Z85-encoded CurveZMQ keys are used to authenticate connections between ZeroMQ sockets. The Z85 alphabet was carefully designed to be safe in all text contexts (including JSON, XML, and C strings) while providing maximum information density.

For developers working on binary protocol design where data must be embedded in text-based protocols (configuration files, log formats, API responses, or database fields that expect ASCII strings), Base85 provides the best available efficiency without resorting to more complex compression schemes. Our free online Base85 encoder decoder is particularly useful for developers debugging these protocols by encoding and decoding individual messages or data blocks.

Tips for Best Results with Base85

When working with Base85 encoding, choosing the right variant for your use case is the most important decision. If you are working with PDF or PostScript documents, use ASCII85 with delimiters (Adobe variant). If you are working with ZeroMQ or building a similar messaging system that needs key encoding, use Z85. If you are working with Python systems that use base64.b85encode(), use the Python variant. If you are working with IPv6 addresses or RFC-compliant systems, use RFC 1924. For general-purpose use where you control both the encoder and decoder, ASCII85 without delimiters is the simplest and most widely understood choice.

When encoding large files or binary data, keep in mind that the zero-word 'z' optimization (enabled by default in our tool) can significantly reduce output size for sparse data but may also produce output with variable-length tokens that some decoders might not expect. If you know your decoder does not support the 'z' shortcut, disable it in the Options tab. Similarly, the 'y' shortcut for space-filled words (0x20202020) is supported by some but not all ASCII85 implementations, so verify your target decoder's capabilities before relying on it.

For the best decoding experience, always use the "Strip Whitespace from Input" option when decoding Base85 that may have been wrapped at line boundaries (a common practice in PDF and PostScript, where ASCII85 streams are typically wrapped at 76 or 80 characters). Our tool enables this by default, but if you are working with Base85 data where whitespace is significant (unusual but theoretically possible), you can disable it.

Conclusion: The Essential Base85 Tool for Every Developer

Our Base85 encoder decoder online is the most comprehensive Base85 tool available, combining five variant support (ASCII85, Adobe, RFC 1924, Z85, Python), accurate zero-word and space-word optimization, file encoding for any file type, batch processing with progress tracking, character-by-character validation, multi-encoding comparison, and multiple input/output format options—all running entirely in your browser with complete privacy. Whether you need to encode Base85 online for a PDF content stream, decode Base85 online for ZeroMQ key analysis, validate an ASCII85 block from a PostScript file, or compare Base85's efficiency against Base64 for your specific data, our free online Base85 encoder decoder delivers accurate, professional results instantly and without any signup or data upload. Bookmark this tool as your go-to free Base85 encode decode tool for all encoding and decoding tasks.

Frequently Asked Questions

Base85 is a binary-to-text encoding that converts every 4 bytes of binary data into 5 printable ASCII characters, using 85 distinct symbols. Base64, by comparison, converts every 3 bytes into 4 characters using 64 symbols. The key advantage of Base85 is efficiency: it has 25% overhead versus Base64's 33% overhead, making encoded output about 8% smaller. Base85 is used in PDF, PostScript, ZeroMQ, and other systems where size efficiency matters. Base64 is more universally supported and simpler to implement, which explains its dominance in web APIs and email.

All are Base85 variants but differ in alphabet and conventions: ASCII85 uses characters !–u (0x21–0x75) and supports the 'z' shortcut for null words. Adobe ASCII85 is identical to ASCII85 but wraps the output with "<~" and "~>" delimiters. Z85 (ZeroMQ) uses a different alphabet (0-9a-zA-Z and special chars) designed to be C-string and JSON safe, with no 'z' shortcut. RFC 1924 uses yet another alphabet ordering and was designed for compact IPv6 address representation. Python base85 uses the ASCII85 alphabet without shortcuts. Our tool implements all five variants accurately.

The 'z' shortcut is an optimization in ASCII85 where a 4-byte group of all zeros (0x00000000) is encoded as the single character 'z' instead of the 5-character sequence '!!!!!'. This provides significant compression when encoding data with many null bytes (sparse binary files, padded data structures, null-terminated strings with long tails). Without the shortcut, 4 null bytes → 5 chars; with it, 4 null bytes → 1 char (80% reduction for those bytes). Enable "Use 'z' shortcut for zero words" in Options to use this optimization. Similarly, 'y' shortcut handles 4-byte groups of all space characters (0x20202020).

Adobe designed PDF using ASCII85 for several reasons: (1) ASCII85 produces about 8% less output than Base64 for the same binary data, which is significant for large embedded images and compressed streams; (2) the 'z' shortcut further reduces size for null-heavy data; (3) ASCII85 was already used in PostScript (PDF's predecessor) so the tooling existed; (4) PDF also supports hexadecimal encoding, but ASCII85's 25% overhead is much better than hex's 100% overhead. Modern PDFs often use binary streams with no encoding at all (wrapped in specific delimiters), but ASCII85 remains supported for compatibility with older systems.

Z85 is a Base85 variant defined in the ZeroMQ RFC (45/CURVE) for encoding curve25519 public keys and other binary payloads. ZeroMQ uses it because: (1) it needs a compact text representation of 32-byte keys (Z85 produces 40 characters vs Base64's 44); (2) Z85's alphabet is carefully chosen to be safe in C strings (no backslash, no null), JSON (no quotes), XML (no <>&), and command-line arguments; (3) Z85 requires input to be a multiple of 4 bytes, which matches the fixed-size keys it encodes. Our tool fully implements Z85 for encoding/decoding ZeroMQ keys and other 4-byte-multiple binary data.

Yes. The File tab allows encoding any file — images, PDFs, executables, archives — to Base85 text. Drag the file onto the drop zone, select "Encode → Base85", and click Run. The result can be copied or downloaded as a .b85 or .txt file. To decode back, provide the Base85 text and select "Decode → File". For large files, Base85 is more efficient than Base64 (25% vs 33% overhead), making it worthwhile for data-intensive applications. All processing happens in your browser — no files are uploaded to any server.

Select "Adobe ASCII85 (<~ ~> delimiters)" as the variant, switch to Decode mode, paste your Adobe-encoded string (including the <~ and ~> markers), and the tool will automatically strip the delimiters and decode the content. If you paste Adobe ASCII85 without delimiters, the decoder will also work correctly. The "Strip Whitespace from Input" option (enabled by default) removes any line breaks that may have been inserted at column 76 or 80 (common in PDF streams) before decoding.

Yes, completely safe. The entire tool runs in your browser — all Base85 encoding, decoding, and file processing happens locally in JavaScript with no server communication. Your data never leaves your device. You can verify this by opening your browser's developer tools network tab while using the tool and observing that no requests are made. However, remember that Base85 is an encoding scheme, not encryption — it does not protect data from anyone who can read the encoded output. For actual data protection, use encryption before encoding.

Z85 requires input whose length is a multiple of 5 characters (since 5 Z85 chars = 4 bytes). If your Z85 string has a length that is not divisible by 5, it's either malformed or uses a non-standard padding scheme. Z85 also requires the original binary data to be a multiple of 4 bytes — Z85 does not define a padding mechanism for partial groups like ASCII85 does. If you're working with ZeroMQ curve keys, they are always exactly 32 bytes → 40 Z85 characters, so this shouldn't be an issue. Use our Validate tab to check your string for invalid characters and length issues before decoding.

For 100 bytes of input: Base64 produces 136 characters (33.3% overhead), Base85 produces 125 characters (25% overhead). The difference is 11 characters or about 8% smaller. For 1 MB of binary data: Base64 produces ~1.37 MB, Base85 produces ~1.25 MB. The practical saving is about 8-9% in encoded size. For data with many null bytes (using the 'z' shortcut), Base85 can be dramatically more compact. Use our Compare tab to see exact numbers for your specific data. For most web APIs, the implementation simplicity of Base64 outweighs Base85's size advantage, but for PDF, PostScript, and embedded systems work, Base85 is consistently preferred.