Base64Hub

Base85 Encoder: Ascii85 & Z85 Radix-85 Workbench

Transcode 32-bit binary words into 5-character Base85 and Adobe Ascii85 (<~...~>) streams with 25.00% overhead, ZeroMQ Z85 JSON-safe alphabets, and 'z' zero-word compression.

4-TO-5 BYTE (+25.00%)
4 B
<~9jqo^~>
Radix-85 Stream (Saves 8.33% vs Base64)
Input Payload4 Bytes (32 Bits)
Radix-85 Chars5 Chars (+ Delims)
32-Bit Uint32 Word0x4D616E20
Zero-Tuple ('z') Hits0 All-Zero Quanta
32-Bit Big-Endian Word Decomposition Across Powers of 85 (85^4 .. 85^0) 52,200,625 · 614,125 · 7,225 · 85 · 1
Word[0] = 0x4D616E20 (1,298,230,816) = 24*85^4 + 73*85^3 + 80*85^2 + 78*85^1 + 61*85^0
Ascii85 (+33 offset): [57='9', 106='j', 113='q', 111='o', 94='^'] -> "9jqo^"
32-bit binary register dividing across five powers of 85 into an Adobe Ascii85 and ZeroMQ Z85 output bus
32-bit big-endian word division across 85^4..85^0 into 5 Radix-85 characters (+25.00% wire overhead).
Radix-85 (Ascii85 / Z85 / RFC 1924) Normative Summary

Base85 (also known as Ascii85 in Adobe PostScript and PDF streams) encodes every 4-byte (32-bit unsigned big-endian) binary word into 5 printable ASCII characters using base-85 positional division. Because 855 = 4,437,053,125 > 232 = 4,294,967,296, Base85 reduces binary-to-text expansion from Base64's +33.33% down to +25.00%.

Base85 (+25.00%) vs. RFC 4648 Base64 (+33.33%) Wire Overhead

5/4 Radix-85 byte expansion compared against 4/3 Base64 expansion across payload sizes

Base85 / Ascii85 (1.250x) RFC 4648 Base64 (1.333x)
56 B 28 B 0 B 0.25x Raw 14 B Payload (20 B B64) 2.0x Scale
RFC 4648 Information Density Ratio (Raw / Base64 Wire Size) 75.0% Payload Efficiency (+33.3% Overhead)
32-Bit Unsigned Word to 5-Digit Radix-85 Bijection
W32 = ∑k=03 Bk2563-k = ∑j=04 dj854-j

How Does Base85 Convert 32-Bit Binary Words Into Five Printable Characters Under the Ascii85 Standard?

Base85 treats every contiguous 4-byte slice as an unsigned 32-bit big-endian integer (0 to 4,294,967,295) and decomposes it by radix division across five powers of 85 (854 down to 850). Encoding 4 UTF-8 bytes ("Man ") yields 5 Ascii85 characters ("9jqo^"), cutting wire expansion by 25% relative to Base64.

Whereas the 3-to-4 byte bit-slicing algorithm in our Data:Image/PNG;Base64 & RFC 4648 Base64URL Hub relies purely on bitwise shifts (>> 2, >> 4, >> 6) because 64 = 26 is an exact power of two, 85 is not a power of two (85 = 5 × 17). Consequently, every Base85 encoder and decoder performs integer division and modulo arithmetic over 32-bit registers.

Engineers inspecting compressed PDF /ASCII85Decode streams, Git binary patch diffs, or ZeroMQ curve certificates frequently cross-check raw 32-bit words in our Hexadecimal, Binary & IEEE 754 Register Decoder or compare multi-line packet wrappers in our OpenPGP RFC 4880 ASCII Armor & CRC24 Verifier.


Formal Mathematical Proof & Byte Boundary Audit

Mathematical Specifications, Native MathML Models & Verification Vectors

Formal IETF RFC 4648, IEEE Radix-16, ITU-R M.1677-1, and NIST FIPS 180-4 equations governing the client-side engine.

RFC 4648 §4 Base64 24-Bit Quantum Expansion

Verified Standard
LB64=4×⌈n3⌉andPpad=(3−(nmod3))mod3

Every 3-octet (24-bit) input group subdivides into four 6-bit indices (0..63). Remainder octets require 1 or 2 padding (0x3D) characters to align the 4-character quantum.

n (Input UTF-8 Bytes)
14

Byte length emitted by UTF-8 TextEncoder.encode(str)

L_B64 (Encoded Wire Size)
20

4-byte aligned ASCII output length (+33.33% ceiling)

RFC 4648 §8 Base16 Hexadecimal Positional Radix

Verified Standard
V10=∑i=0k−1di⋅16iwhereLHex=2n

Splits each 8-bit octet into high (b >> 4) and low (b & 0x0F) 4-bit nibbles mapped onto 0–9 and A–F, doubling character length (+100%).

L_Hex (Hex Nibble Length)
28

Two hexadecimal nibbles per raw input byte

0xFF (Max Octet Value)
255 Dec

Binary 11111111 full 8-bit unsigned integer ceiling

ITU-R M.1677-1 International Morse Signal Timing

Verified Standard
Tdah=3⋅Tdit,Tchar=3⋅Tdit,Tword=7⋅Tdit

Standardizes telegraph pulse durations relative to the fundamental dot quantum T_dit (1200 / WPM milliseconds under PARIS 50-unit calibration).

T_dit (Dot Unit)
1 Unit

Base pulse duration and intra-character element gap

T_word (Word Delimiter)
7 Units

Represented by "/" between space-delimited character codes

NIST FIPS 180-4 SHA-256 Compression Functions

Verified Standard
Ch(e,f,g)=(e∧f)⊕(¬e∧g),Maj(a,b,c)=(a∧b)⊕(a∧c)⊕(b∧c)

Processes 512-bit padded blocks across 64 Merkle-Damgård rounds over eight 32-bit state registers (H0..H7) to emit a 256-bit (64-hex-char) digest.

H_0..H_7 (Digest State)
256 Bits

Fractional square roots of the first 8 primes (2..19)

K_0..K_63 (Round Constants)
64 Words

Fractional cube roots of the first 64 primes (2..311)

Empirical Specification Verification Matrix

Vector Profile Input Stream Deterministic Output Byte Boundary Implication
UTF-8 Greeting Vector Plaintext: "Hello, Base64!" (14 B) SGVsbG8sIEJhc2U2NCE (1-pad, 20 B) 5-quantum ceiling with single 0x3D padding character (n mod 3 is 2).
High-Bit Octet Sequence Bytes: [251, 255, 191] (0xFBFFBF) Std: +/+/ | URL: -_-_ RFC 4648 §5 replaces "+" and "/" to prevent URL query corruption.
Hexadecimal Byte Stream Hex: "48 65 78" & "0xFF" ASCII: "Hex" | Dec: 255 (11111111) Case-insensitive radix-16 nibble parsing without NaN truncation.
ITU-R Distress Signal Plaintext: "SOS" (3 Chars) ... --- ... (27 Timing Units) 3 dits + 3-unit gap + 3 dahs + 3-unit gap + 3 dits.
NIST FIPS 180-4 Vector Input: "abc" (24 Bits) ba7816bf8f01cfea...f20015ad (64 Hex) Single 512-bit block compression yielding deterministic 256-bit digest.

1. Paul Rutter's btoa Utility & Adobe PostScript Filter

Originally created by Paul E. Rutter for the UNIX btoa utility and adopted by Adobe PostScript Level 2 and PDF (/ASCII85Decode), Ascii85 wraps streams in <~ and ~> delimiters and ignores whitespace during decoding.

2. All-Zero ('z') and All-Space ('y') Run-Length Shortcuts

In Adobe Ascii85, a 32-bit word of four zero bytes (0x00000000) compresses to a single z character instead of !!!!!. Extended btoa v4.2 also defines y to compress four ASCII spaces (0x20202020, 538,976,288).

3. ZeroMQ Z85 String-Literal Safety for JSON & C/C++

Pieter Hintjens designed ZeroMQ RFC 32/Z85 for encoding 32-byte Curve25519 keys into 40-character strings without escaping. Z85 replaces ", ', \, and backtick quotes with safe symbols so JSON parsers never break.

4. Git Binary Diff Base85 Encoding (RFC 1924 Variant)

When running git diff --binary or git format-patch, Git encodes compressed binary delta hunks using an RFC 1924-derived 85-character alphabet with a leading line-length indicator byte (A–Z, a–z).

How Do Adobe Ascii85, ZeroMQ Z85, IETF RFC 1924, and RFC 4648 Base64 Compare?

Compare alphabet ranges, delimiter conventions, zero-word compression rules, and JSON string safety across all major Base85 variants and RFC 4648 Base64.

Encoding Variant Input → Output Quantum Character Alphabet (85 Symbols) Zero Shortcut Framing Delimiters Primary Ecosystem
Adobe Ascii854 Bytes → 5 Chars (+25%)ASCII 33 ('!') to 117 ('u')'z' (0x00000000)<~ ... ~>PDF /ASCII85Decode & PostScript
UNIX btoa v4.24 Bytes → 5 Chars (+25%)ASCII 33 ('!') to 117 ('u')'z' (0x00) & 'y' (0x20)xbtoa Begin / EndLegacy UNIX Archive Streams
ZeroMQ Z85 (RFC 32)4 Bytes → 5 Chars (+25%)0-9, a-z, A-Z, .-:+=^!/*?&<>@%$# plus parens & bracketsNone (Fixed 4n)None (JSON Safe)CurveZMQ 32-Byte Keys (40 Chars)
IETF RFC 192416 Bytes → 20 Chars (+25%)0-9, A-Z, a-z, !#$%&*+-;<=>?@^_|~ plus parens & bracesNoneNone128-Bit IPv6 & Git Binary Diffs
RFC 4648 Base643 Bytes → 4 Chars (+33.3%)A-Z, a-z, 0-9, +, / (64 chars)None ('AAAA')'=' Tail PaddingMIME, Data URIs, JWTs
RFC 4648 Multi-Radix Protocol Inspector

Filename & URI Safe Base64URL Alphabet (Indices 62 & 63)

Replaces standard Base64 index 62 (+) with hyphen-minus (-, 0x2D) and index 63 (/) with underscore (_, 0x5F) while omitting trailing = (0x3D) padding characters for OAuth 2.0 PKCE and JWT headers.

Quantum Block
24-Bit (3 Octets -> 4 Sextets)
Index 62 / 63
- (0x2D) / _ (0x5F)
Canonical Vector
[251,255,191] -> -_-_

Positional Radix Expansion & Overhead Comparison Matrix

Filter Base16, Base32, Base58, Base62, Base64, and Base85 specifications.

Encoding SchemeNormative RFCInput -> Output QuantumWire ExpansionPadding & URL Safety
Base64 Standard IETF RFC 4648 §4 3 Bytes (24b) -> 4 Sextets +33.33% (4/3n) Mandatory = (0x3D); unsafe + and / in URIs
Base64URL (Filename Safe) IETF RFC 4648 §5 3 Bytes (24b) -> 4 Sextets +33.33% (4/3n) Optional = omitted; uses - (0x2D) and _ (0x5F)
Base32 Uppercase IETF RFC 4648 §6 5 Bytes (40b) -> 8 Quintets +60.00% (8/5n) Uses A–Z and 2–7; case-insensitive DNS/TOTP safe
Base16 Hexadecimal IETF RFC 4648 §8 1 Byte (8b) -> 2 Nibbles +100.00% (2n) Zero padding; deterministic 0x00–0xFF nibble pairs
Percent-Encoding IETF RFC 3986 §2.1 1 Reserved Byte -> %XX Variable (1x–3x) Escapes reserved URI delimiters via % hex triplets
Interactive Specification & Edge-Case Decision Matrix

Interactive Encoding & Cryptographic Architecture Decision Tree

Select your engineering transport constraint to isolate the compliant IETF/NIST specification and load its verification vector directly into the workbench.

Scenario 01 | 4 × ⌈n / 3⌉ Bytes
Inline Data URIs, MIME Attachments & TLS PEM
Scenario 02 | Zero %2B / %2F Escaping
OAuth 2.0 PKCE Verifiers, JWT Tokens & URL Params
Scenario 03 | 2n ASCII Nibbles
Memory Dumps, Network Packet Inspection & Byte Debugging
Scenario 04 | 64-Char Fixed Hex
Immutable Checksums, Git Commits & Distributed IDs
Recommended Standard

IETF RFC 4648 §4 Standard Base64 (6-Bit Sextet + 0x3D Padding)

1.333x Expansion (+33.3%)

Use Standard Base64 when embedding small raster icons (under 4 KB) in CSS/HTML Data URIs or encoding X.509 certificates where strict 4-character quantum padding (0x3D) is required by MIME parsers.

Normative Specifications
RFC 4648 §4 Base64RFC 2397 Data URIRFC 7468 PEM Armor
Wire Size Rule
4 × ⌈n / 3⌉ Bytes

Frequently Asked Questions About Base85, Ascii85 & Z85 Encoding

Why does Base85 and Ascii85 encoding achieve a 25.00% byte overhead compared to 33.33% in Base64 encoding? +

Because 85^5 (4,437,053,125) is strictly greater than 2^32 (4,294,967,296), a Radix-85 encoder maps every 4-byte (32-bit unsigned big-endian integer) input quantum into five printable ASCII characters (5/4 = 1.250x expansion, or +25.00% overhead). By contrast, IETF RFC 4648 Base64 maps every 3-byte (24-bit) quantum into four characters (4/3 = 1.333x expansion, or +33.33% overhead).

How does the 4-byte string 'Man ' encode into '9jqo^' under the Adobe Ascii85 specification? +

The four ASCII characters 'M' (0x4D), 'a' (0x61), 'n' (0x6E), and ' ' (0x20) form the 32-bit big-endian integer 0x4D616E20 (decimal 1,298,230,816). Repeatedly dividing by powers of 85 (85^4 = 52,200,625; 85^3 = 614,125; 85^2 = 7,225; 85^1 = 85; 85^0 = 1) yields base-85 digits [24, 73, 80, 78, 61]. Adding 33 ('!') to each digit produces ASCII codes [57, 106, 113, 111, 94], which correspond to '9jqo^'.

Why does Adobe Ascii85 replace an all-zero 32-bit word (0x00000000) with a single 'z' character? +

Under standard Radix-85 offset rules (+33), an all-zero 4-byte word (0x00000000) would encode to five exclamation marks ('!!!!!'). Because uncompressed raster images and PostScript streams contain long runs of zero bytes, Adobe Ascii85 maps a full 4-byte zero quantum to a single lowercase 'z' (which lies outside the '!' through 'u' alphabet), achieving 4:1 compression on zeroed memory blocks.

How does ZeroMQ Z85 differ from Adobe Ascii85 when embedding binary tokens in JSON or source code? +

Adobe Ascii85 uses contiguous ASCII code points 33 ('!') through 117 ('u'), which include double quotes ('"'), single quotes ('\''), and backslashes ('\\') that require escaping inside JSON, XML, and C/Python string literals. ZeroMQ Z85 (RFC 32/Z85) curates an 85-character alphabet that omits quotes and backslashes so Base85 strings embed directly inside JSON without escape sequences.

How are trailing 1-byte, 2-byte, and 3-byte partial quanta padded during Ascii85 encoding and decoding? +

When encoding a tail chunk of N bytes (where N is 1, 2, or 3), the encoder appends (4 - N) zero bytes (0x00), performs the 32-bit division by powers of 85, and outputs only the first (N + 1) characters without applying the 'z' shortcut. During decoding, a partial group of M characters (where M is 2, 3, or 4) is padded with (5 - M) 'u' characters (value 84) so high-byte rounding carries are preserved before keeping the first (M - 1) bytes.