Why Base64 Makes Files About 33% Larger
If you've ever compared a file's size before and after Base64 encoding, you've noticed the encoded version is noticeably bigger — consistently about a third larger. That overhead isn't a quirk of any particular tool; it's a direct consequence of how Base64 packs bits.
The bit math
Base64 groups input into chunks of 3 bytes (24 bits) and splits each chunk into four 6-bit groups, mapping each group to one of 64 printable characters. Three input bytes (24 bits) always produce exactly four output characters (24 bits' worth of 6-bit groups) — so the size ratio is fixed at 4/3, or a 33.3% increase, regardless of what the data actually contains.
The exact formula
Encoded length in characters = ceil(inputBytes / 3) * 4. The ceil (round up) accounts for inputs that aren't an exact multiple of 3 bytes: the final group gets padded with one or two = characters so the total length is always a multiple of 4. For example, a 10-byte input: ceil(10/3)*4 = 4*4 = 16 characters.
Some worked examples
1 KB (1,024 bytes) of data encodes to ceil(1024/3)*4 = 1,368 characters — 1,368 bytes as ASCII text, a 33.6% increase. A 1 MB image encodes to roughly 1.37 MB of Base64 text. Try your own numbers with the Base64 Size Calculator.
When the overhead actually matters
For small text snippets, tokens, or config values, a 33% increase is negligible. It starts to matter for larger binary payloads: embedding a large image as a data URI, attaching big files to email via MIME, or storing large blobs as Base64 text in a database column — in each case, weigh the convenience of text-safe encoding against the extra bandwidth, storage, and (for HTTP responses) potential compression inefficiency the overhead introduces.