Base64 vs Hex vs Base32: Which Encoding Should You Use?
Base64, hexadecimal and Base32 all solve the same problem — turning binary data into printable text — but they trade off compactness, readability and alphabet size differently. Here is how they compare, and how to pick the right one.
The core tradeoff: alphabet size vs. output size
Every binary-to-text scheme packs a fixed number of input bits into each output character. Hex uses a 16-character alphabet and packs 4 bits per character, so every byte (8 bits) becomes exactly 2 hex characters — a 100% size increase. Base32 uses 32 characters and packs 5 bits per character, for roughly a 60% increase. Base64 uses 64 characters and packs 6 bits per character, for about a 33% increase — the smallest of the three. See the exact math in why Base64 makes files ~33% larger.
Readability and human-friendliness
Hex is the easiest to read at a glance — each byte maps to exactly two characters (0-9, a-f), which is why it is the default for hashes (MD5, SHA), colors, and memory addresses. Base32 avoids visually ambiguous characters like 0/O and 1/I/l, and is case-insensitive, which makes it a good fit for codes a person might type by hand — TOTP two-factor secrets and some license keys use Base32 for this reason. Base64 is the least human-friendly of the three (mixed case, plus + and / symbols) but wins on compactness, which is why it dominates machine-to-machine formats like data URIs, JWTs and API payloads.
Quick comparison
The text Hi (bytes 0x48 0x69) encodes as: hex 4869 (4 characters), Base32 JBQW4=== (8 characters with padding), Base64 SGk= (4 characters). At this tiny size the difference is marginal, but it scales linearly with input — for a 1 MB file, Base64 output is roughly 250 KB smaller than the equivalent Base32 output.
When to use which
Use hex for hashes, checksums, colors, and anywhere you or a teammate will read the value directly. Use Base32 for short human-entered secrets where case-sensitivity and character ambiguity would cause errors. Use Base64 (or its URL-safe variant) for everything else — API payloads, data URIs, tokens, and any binary data that needs to move through a text-only channel as compactly as possible. Try it with the Base64 converter or the hex to Base64 tool.