Base64 — the universal default
Base64 uses 64 alphabet characters (A–Z, a–z, 0–9, +, /) plus '=' for padding. Each input byte becomes ~4/3 output characters — about 33% overhead. It is the default for almost every binary-in-text use case: data URLs, JWTs, email attachments, PEM keys. The 'url-safe' variant (RFC 4648) replaces '+' and '/' with '-' and '_' for URL-safe use.
Base58 — Bitcoin's choice
Base58 uses 58 characters (alphanumeric, but excluding the visually confusing 0, O, I, l). It produces slightly longer output than Base64 (~37% overhead vs 33%), but the result has no ambiguous characters and no special symbols at all. This makes it ideal for keys and addresses that humans copy by sight or speak over the phone. Bitcoin, IPFS, and many cryptocurrency systems use Base58.
Base32 — case-insensitive and typeable
Base32 uses 32 characters (RFC 4648: A–Z, 2–7). It is significantly less dense than Base64 (~60% overhead) but produces output that is case-insensitive, contains no special characters, and is easy to type or read aloud. TOTP secrets, DNS records (TXT records that mustn't be case-sensitive), and onion addresses all use Base32. There is also the Crockford variant (used by ULID) that excludes I/L/O/U to avoid visual confusion.
Size overhead comparison
- Base64: ~33% overhead (3 bytes in → 4 chars out).
- Base58: ~37% overhead, but slightly variable because 58 is not a power of 2.
- Base32: ~60% overhead (5 bytes in → 8 chars out).
- For 32 bytes of input: Base64 ≈ 44 chars, Base58 ≈ 44 chars, Base32 ≈ 56 chars.
Use case matrix
- Inline data in JSON, HTTP headers, email: Base64.
- URL parameters: Base64 url-safe (or Base58).
- Human-readable identifiers (Bitcoin wallets, public keys): Base58.
- Phone-speakable or hand-typed codes: Base32 Crockford.
- TOTP/MFA shared secrets: Base32 (RFC 4648 spec).
- DNS TXT records storing binary data: Base32.
Encoding speed and library support
Base64 is built into every standard library. Base32 is in most. Base58 is rarely in standard libraries and usually comes from a third-party package. For high-throughput pipelines, Base64 is the fastest by an order of magnitude due to CPU vectorization. Base58 is the slowest because it requires arbitrary-precision arithmetic.
Padding
Base64 pads to multiples of 4 with '='. Base32 pads to multiples of 8 with '='. Base58 has no padding (because the encoding is variable-length anyway). For URL-safe Base64 and modern formats, padding is often stripped — make sure your decoder accepts both forms.