Base64Hub

Base62 Encoder: Alphanumeric Radix-62 URL Workbench

Encode 64-bit integer keys, transcode 128-bit UUIDs, and convert binary payloads into clean, URL-safe Base62 alphanumeric tokens ([0-9A-Za-z]) with zero percent-escaping.

RADIX-62 (URL-SAFE)
10 Digits
1LY7vk
Radix-62 Alphanumeric: [0-9A-Za-z] with zero delimiter escaping in URLs
Input Magnitude10 Digits
Base62 Output6 Characters
Short URL Compression40.0% Reduction
Alphanumeric Set62 Glyphs (0-9A-Za-z)
Radix-62 Polynomial Division (62^k) URL-Safe Alphanumeric Tokenizer
1234567890 = 1*62^5 + 21*62^4 + 34*62^3 + 7*62^2 + 57*62^1 + 46*62^0
Digits [1, 21='L', 34='Y', 7='7', 57='v', 46='k'] -> "1LY7vk"
High-speed web server routing engine and distributed database primary key hashing infrastructure processing Base62 alphanumeric tokens
Distributed routing cluster compressing 128-bit UUID primary keys into 22-character alphanumeric Base62 URL tokens.
Radix-62 Alphanumeric Encoding Specifications

Base62 uses exactly 62 alphanumeric characters (0-9, A-Z, a-z). It provides 5.954 bits of entropy per character, packing large numbers and raw byte streams into minimal character lengths while completely eliminating URL reserved symbols like +, /, and =.

Base62 (5.95b) vs. Base64 (6.00b) vs. Base36 (5.17b) Information Density

Bits of entropy encoded per output character across non-power-of-two radices

Radix-62 Entropy (5.954 bits/char) RFC 4648 Base64 (6.000 bits/char)
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)
Big-Integer Radix-62 Modulo Polynomial Decomposition
Vint = ∑i=0m-1 Bi256m-1-i = ∑j=0k-1 Dj62k-1-j

Why Does Base62 Eliminate Delimiter Collisions and URL Escaping in Distributed Web Systems?

Base62 encodes binary integers and UUIDs using strictly alphanumeric ASCII characters [0-9A-Za-z]. Unlike standard Base64—which requires reserved punctuation characters '+' and '/' that trigger percent-encoding (%2B, %2F) in HTTP query strings—Base62 tokens remain verbatim, URL-safe, filesystem-safe, and double-click selectable without delimiter collisions.

In high-scale database architectures, exposing sequential auto-incrementing integers (e.g., id=1049281) creates enumeration vulnerabilities. By converting these integers into Base62 tokens (such as 49R1), routing engines obscure internal database volume while retaining microsecond decoding speeds without bitwise padding overhead seen in Base64 Encoding & Data URI Converters.

Engineers migrating from Bitcoin address formats inspect Base58 & Base58Check Decoder, while developers generating 128-bit random tokens cross-reference our RFC 4122 UUID v4 & CSPRNG Key Generator or verify raw hexadecimal dumps in Hexadecimal & Binary Byte Converters.


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. Alphanumeric 62-Character Alphabet

Comprising digits 0–9 (values 0–9), uppercase A–Z (values 10–35), and lowercase a–z (values 36–61). Contains zero punctuation symbols, hyphens, or underscores.

2. 128-Bit UUID Compression to 22 Characters

By treating 16-byte UUIDs as 128-bit BigInts, Base62 represents all 340 undecillion values in 22 alphanumeric symbols, compressing standard 36-char hyphenated UUIDs by nearly 39%.

3. Zero-Padding and Lexicographical Sorting

When numbers are fixed-width zero-padded, Base62 preserves natural numerical order in ASCII sorts because numeric characters precede capital letters, which precede lowercase letters.

4. URL Shortener and Routing Standard

Standard routing engines in Bitly, TinyURL, and microservices employ Base62 IDs to ensure that URL slugs can be parsed by any browser or shell without URI percent-encoding bugs.

How Do Base62, Base64URL, Base58, and Base36 Encodings Compare?

Examine radix base sizes, character alphabets, bit densities, punctuation immunity, and web application suitability across modern string encoding formats.

Encoding Format Base Size Character Set Punctuation Used Bits / Char 128-Bit UUID Length Primary Application
GMP Base62 62 0-9, A-Z, a-z None (0%) 5.954 22 chars URL shorteners, Compact database keys, Microservice tokens
Base64URL (RFC 4648) 64 0-9, A-Z, a-z, -, _ - and _ 6.000 22 chars JSON Web Tokens (JWT), WebAuthn credentials
Bitcoin Base58 58 1-9, A-HJ-NP-Za-km-z None (No 0,O,I,l) 5.858 22-23 chars Cryptocurrency addresses, IPFS CIDv0 hashes
Radix-36 (Base36) 36 0-9, a-z (case-insensitive) None (0%) 5.170 25 chars Compact timestamp IDs, Case-insensitive tokens

Frequently Asked Questions: Base62 URL Token & Key Encoding

Why is Base62 preferred over Base64 for URL shorteners like Bitly and modern routing engines? +

Standard Base64 contains '+' and '/' characters, which carry reserved semantic meanings in HTTP query strings and URL path routing. In URLs, '+' decodes into a space and '/' acts as a directory separator, necessitating percent-encoding (%2B, %2F). Base62 uses strictly alphanumeric ASCII characters [0-9A-Za-z], ensuring zero percent-encoding overhead and 100% URL-safe routing across web proxies and CDN caches.

How does Base62 compress a 128-bit UUID into a compact 22-character string? +

A canonical RFC 4122 UUID is 36 characters long including 4 hyphens. By treating the underlying 128-bit binary payload as a single large unsigned integer (up to 3.4028e+38) and dividing repeatedly by 62 (log2(62) ≈ 5.954 bits per symbol), Base62 represents all 2^128 possible states in at most ceil(128 / log2(62)) = 22 alphanumeric characters, reducing string length by 38.9%.

Does Base62 preserve lexicographical sort order across database primary keys? +

Standard GMP/POSIX Base62 (0-9, A-Z, a-z) preserves numeric sort order only if values are zero-padded to uniform fixed length. Because ASCII '9' (0x39) precedes 'A' (0x41) and 'Z' (0x5A) precedes 'a' (0x61), padded strings sort identically to their unsigned numeric integers. Variable-length Base62 strings require length-prefixed sorting in B-tree database indexes.

What character alphabet does Base62 employ across industry implementations? +

The normative industry standard (GMP/libgmp) specifies indices 0–9 as '0'–'9', 10–35 as 'A'–'Z', and 36–61 as 'a'–'z'. An inverted variant (0-9, a-z, A-Z) is sometimes employed in Java libraries, but GMP order remains the universal convention across database engines, URL slug generators, and distributed identifier protocols.

What is the difference between Base62 and Base64URL encoding formats? +

Base64URL modifies standard Base64 by swapping '+' and '/' for '-' and '_', leaving an alphabet of 64 symbols that still requires bit-level padding '=' handling or stripped padding rules. Base62 avoids all punctuation marks completely, producing 100% alphanumeric strings that never break regular expressions expecting [a-zA-Z0-9].

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] -> -_-_
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