Base64 vs Base32 vs Base58 vs Base85: Which and Why

Binary data keeps needing to travel through channels that only accept text: JSON fields, email bodies, URLs, QR codes, config files, printed paper. Every base encoding solves that same problem, and the differences between them come down to a single trade-off — how many characters the alphabet has versus how safe those characters are in the place the string will end up.
The trade-off in one table
| Encoding | Alphabet size | Size overhead | Block | Typical home |
|---|---|---|---|---|
| Base16 (hex) | 16 | +100% | 1 byte → 2 chars | Hashes, memory dumps, keys, MAC addresses |
| Base32 | 32 | +60% | 5 bytes → 8 chars | TOTP secrets, case-insensitive identifiers, DNS |
| Base45 | 45 | +50% | 2 bytes → 3 chars | Alphanumeric QR codes (EU digital certificates) |
| Base58 | 58 | ≈ +37% | none (big number) | Bitcoin addresses, IPFS hashes, short IDs |
| Base62 | 62 | ≈ +34% | none (big number) | URL shorteners, opaque identifiers |
| Base64 | 64 | +33% | 3 bytes → 4 chars | Email (MIME), data URLs, JSON, JWT |
| Base85 / Ascii85 | 85 | +25% | 4 bytes → 5 chars | PDF, PostScript, Git binary diffs |
| Z85 | 85 | +25% | 4 bytes → 5 chars | ZeroMQ, config files needing safe punctuation |
More characters in the alphabet means fewer characters in the output — and a higher chance one of them causes trouble somewhere downstream.
Base16: when readability beats size
Hex doubles your data, which sounds wasteful until you notice what you get: every byte maps to exactly two characters, always in the same position, with no state, no padding and no block boundaries.
That is why hashes, keys, IVs and memory dumps are hex. You can point at a character and know exactly which byte it belongs to. You can truncate anywhere. You can compare two values by eye. The length is a fingerprint of its own — 32 characters is MD5, 40 is SHA-1, 64 is SHA-256, 128 is SHA-512.
Base32: the case-insensitive one
Base32 uses A-Z and 2-7 — no lowercase, no 0, 1 or 8. That specific alphabet exists to survive being spoken, typed and case-folded: there is no 0/O or 1/l ambiguity, and a system that upper-cases everything (like DNS) does not corrupt it.
The price is 60% overhead, which is why you meet Base32 exactly where humans touch the data: TOTP secrets you type into an authenticator app, onion addresses, case-insensitive file identifiers.
Base64: the default
Base64 encodes 3 bytes as 4 characters using A-Z, a-z, 0-9 and two extras. It is the default because 33% overhead was acceptable for email in 1987 and remains acceptable for JSON in production.
The wrinkle is those last two characters. Standard Base64 uses + and /, and pads with = — all three have meaning inside URLs. Base64URL swaps them for - and _ and normally drops the padding, which is why JWT segments look like Base64 with the punctuation filed off. The decoded bytes are the same; only the transport-safe skin differs.
One thing Base64 is not: protection. It is a keyless, public transformation. A Base64 string in a config file is plaintext that takes one extra second to read.
Base58 and Base62: no blocks, just big numbers
Base58 and Base62 do not chop input into fixed blocks. They treat the whole byte string as one enormous integer and repeatedly divide it by the base. That is why their output length is not a neat multiple of anything, and why encoding is measurably slower for large inputs — it is arbitrary-precision arithmetic rather than bit shuffling.
Base58 drops four characters from Base62: 0, O, I and l. It also drops + and / compared to Base64. This is a human-factors decision, not a mathematical one. Bitcoin addresses get written on paper, read over the phone and copied by hand, and a confused 0 for O means funds sent nowhere recoverable. Losing a few percent of compactness to remove that class of error is an easy trade.
Base62 keeps all alphanumerics and is what most URL shorteners and opaque-ID schemes use: safe in URLs without escaping, no punctuation, still reasonably compact.
Base85: maximum density
Base85 encodes 4 bytes as 5 characters — 25% overhead, the best of the practical text encodings. It gets there by using nearly every printable ASCII character, including a lot of punctuation.
Ascii85 (Adobe) is what PDF and PostScript use internally, and it has the neat trick of collapsing four zero bytes into a single z. Z85 (ZeroMQ) rearranges the alphabet to exclude backslash, quotes and backtick, so encoded strings can be embedded in source code and config files without escaping — at the cost of requiring the input length to be a multiple of four.
The reason Base85 never became the default is exactly that punctuation: strings full of !, #, $, % and < are hostile to URLs, shells, XML and anything with a parser.
Base45: the QR code specialist
Base45 exists for one narrow reason. QR codes have an alphanumeric mode that packs data far more densely than byte mode, but that mode only permits 45 specific characters: 0-9, A-Z, space, and $%*+-./:. Base45 (RFC 9285) maps two bytes into three of those characters, so binary payloads can use the efficient QR mode.
Its most visible deployment was the EU Digital COVID Certificate, where each certificate was CBOR-encoded, signed, compressed with zlib, then Base45-encoded into a QR code — an unusually clear example of layering encodings for a specific transport.
Recognising them on sight
| What you see | Likely encoding |
|---|---|
0-9a-f only, even length | Base16 (hex) |
A-Z2-7, maybe = padding | Base32 |
Mixed case, digits, +/, length ÷ 4 | Base64 |
Mixed case, digits, -_, no padding | Base64URL |
Mixed case, digits, no 0OIl | Base58 |
Heavy punctuation, !#$%< | Ascii85 / Z85 |
Uppercase with $%*+-./: | Base45 |
Starts with H4sI | Base64-wrapped Gzip |
Three chunks split by . | JWT (Base64URL segments) |
When in doubt, decode and look at the result: a wrong guess normally produces invalid UTF-8 rather than plausible text, which is a strong signal in itself.
Choosing one
- Humans will read, type or dictate it → Base32, or Base58 if you also need compactness.
- It goes in a URL → Base64URL or Base62.
- It goes in JSON, email or a data URL → Base64.
- You need to eyeball individual bytes → hex.
- Size is genuinely critical and the transport is binary-safe → Base85.
- It goes into a QR code → Base45, so the QR's alphanumeric mode applies.
And whichever you pick, the same caveat holds for all of them: encoding is not encryption. If the content is secret, encrypt it first and encode the ciphertext.
Related tools
Frequently asked questions
How much overhead does each base encoding add?
Base16 (hex) doubles the size, a 100% overhead. Base32 adds 60%, encoding 5 bytes as 8 characters. Base64 adds 33%, encoding 3 bytes as 4 characters. Base85 adds only 25%, encoding 4 bytes as 5 characters. Base58 and Base62 are big-number encodings without a fixed block size, landing near 37% and 34% respectively. The trade is always the same: a larger alphabet is more compact but uses characters that are riskier in URLs, filenames or handwriting.
Why does Bitcoin use Base58 instead of Base64?
Base58 deliberately removes the characters that humans and fonts confuse: digit zero, capital O, capital I and lowercase l, plus the symbols + and / that break when an address is double-clicked or placed in a URL. The result is an alphabet of 58 characters that survives being written on paper, read aloud and copied by hand — worth the slightly worse compactness when a typo means permanently lost funds.
What is the difference between Base64 and Base64URL?
Only the last two characters of the alphabet and the padding. Standard Base64 uses + and / and pads with =, all three of which have special meaning in URLs and must be escaped. Base64URL substitutes - and _ and usually drops the padding entirely, so the result can be dropped into a query string, a path segment or a JWT without further escaping. The decoded bytes are identical.
Is Base64 encryption?
No. Base64 is a reversible mapping with no key, so anyone can decode it — it exists to move binary data through channels that only accept text, such as email bodies, JSON fields or data URLs. Treating it as protection is a classic security mistake: a Base64 password in a config file is a plaintext password with extra steps.
How do you recognise which encoding a string uses?
By alphabet and length. Only 0-9 and a-f with an even length is hex. A-Z plus 2-7 with = padding is Base32. Mixed case with digits, + and /, and a length divisible by four, is Base64; the same with - and _ instead is Base64URL. Mixed case with digits but no 0, O, I or l suggests Base58. Punctuation-heavy strings including characters such as ! # $ % are usually Ascii85 or Z85. A leading H4sI means Base64 wrapping a Gzip stream.



