Base64 vs Base58 vs Base32

Updated:

Base64 is the universal binary-to-text encoding, but it has alternatives that solve specific problems Base64 ignores. Base58 (used by Bitcoin) removes visually ambiguous characters; Base32 (used by TOTP secrets and DNS) is case-insensitive and human-typeable. Picking the right encoding for the wrong use case wastes bytes or introduces subtle bugs. This guide compares the three on alphabet design, size overhead, and the situations where each shines.

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.

FAQ

Can I use Base58 to encode arbitrary binary data?
Yes, but the encoding is byte-oriented and slower than Base64. Reserve Base58 for cases where ambiguous-character removal is the whole point (cryptographic addresses, short shareable codes).
Why does TOTP use Base32 instead of Base64?
Users need to type or scan TOTP secrets sometimes. Base32 is case-insensitive and uses only A–Z plus 2–7, which is far easier to enter without mistakes. Compactness is not the priority for a one-time secret setup.
Is Base58Check different from Base58?
Yes. Base58Check appends a 4-byte SHA-256 checksum before encoding, so single-character typos in a Bitcoin address are detected. Plain Base58 has no such check.

In summary

Choose Base64 by default for binary-in-text. Pick Base58 when humans must read or transcribe identifiers without typos. Pick Base32 for case-insensitive, hand-typeable codes like TOTP. Our Base64 Encoder / Decoder handles Base64 directly in your browser — for Base58 or Base32, use a language-specific library that supports the variant you need.

Outils associés