Base64 to Base36 Converter
Convert Base64 encoded data to Base36 representation and back. Supports standard and URL-safe Base64 with arbitrary-precision BigInt math.
About
Base64 encoding expands binary data by roughly 33% because it maps every 3 bytes to 4 ASCII characters from a 64-symbol alphabet. Base36 uses 36 symbols (0 - 9, a - z) and is case-insensitive, which makes it useful for compact URL slugs, short identifiers, and systems that forbid mixed-case or special characters. This tool treats the input as a raw byte stream, accumulates it into an arbitrary-precision integer, then performs radix conversion via repeated division by 36. The reverse path reconstructs the integer from the base36 string and extracts the original byte sequence. Note: the conversion is lossless only when round-tripped through this tool. Passing the base36 output to a system that strips leading zeros will corrupt the data. This tool approximates storage savings assuming uniform random bytes; structured data compresses differently.
Formulas
The conversion treats the Base64-decoded byte array as a big-endian unsigned integer, then re-encodes that integer in base 36.
Step 1 - Decode Base64 to bytes:
B = atob(input) → [b0, b1, …, bn−1]
Step 2 - Accumulate into integer N:
N = n−1∑i=0 bi ⋅ 256n−1−i
Step 3 - Convert N to base 36 via repeated division:
N = q ⋅ 36 + r, where r ∈ {0, 1, …, 35}
Each remainder r maps to character: 0 - 9 → 0 - 9, 10 - 35 → a - z. Digits are collected least-significant first, then reversed.
Bits per character: log2(36) ≈ 5.17, so base36 output is approximately 85.17 ≈ 1.55× the byte count in length.
Where B = decoded byte array, n = byte count, bi = byte value at index i, N = accumulated big integer, q = quotient, r = remainder.
Reference Data
| Base / Encoding | Alphabet | Radix | Bits per Character | Expansion vs Raw | Case Sensitive | Common Use |
|---|---|---|---|---|---|---|
| Binary | 0 - 1 | 2 | 1.00 | 800% | No | Low-level data |
| Octal | 0 - 7 | 8 | 3.00 | 267% | No | Unix permissions |
| Decimal | 0 - 9 | 10 | 3.32 | 241% | No | Human-readable numbers |
| Hexadecimal | 0 - 9, a - f | 16 | 4.00 | 200% | No | Memory addresses, colors |
| Base32 | A - Z, 2 - 7 | 32 | 5.00 | 160% | No | TOTP codes, Crockford IDs |
| Base36 | 0 - 9, a - z | 36 | 5.17 | 155% | No | Short URLs, compact IDs |
| Base58 | 0 - 9, A - Z, a - z (no 0OIl) | 58 | 5.86 | 137% | Yes | Bitcoin addresses |
| Base62 | 0 - 9, A - Z, a - z | 62 | 5.95 | 134% | Yes | URL shorteners |
| Base64 | A - Z, a - z, 0 - 9, +/ | 64 | 6.00 | 133% | Yes | Email (MIME), Data URIs |
| Base64url | A - Z, a - z, 0 - 9, -_ | 64 | 6.00 | 133% | Yes | JWT tokens, URL params |
| Base85 (Ascii85) | 33 - 117 ASCII | 85 | 6.41 | 125% | Yes | PDF, PostScript |
| Base91 | 91 printable ASCII | 91 | 6.51 | 123% | Yes | Compact binary-to-text |
| Base128 | 128 code points | 128 | 7.00 | 114% | Yes | Protobuf varints |