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.

Base64 File Size Overhead — FAQ

Why does Base64 make files about 33% larger?+

Base64 represents every 3 bytes (24 bits) of input as 4 output characters (6 bits each). 4 output characters for 3 input bytes is a 4/3 ratio — a 33.3% increase.

What is the exact formula for encoded size?+

ceil(inputBytes / 3) * 4. This accounts for padding: inputs whose length is not a multiple of 3 get one or two "=" padding characters so the output length is always a multiple of 4.

Does the overhead change for URL-safe or MIME Base64?+

URL-safe Base64 without padding is marginally smaller (it drops the trailing "=" characters). MIME Base64 is marginally larger, since it adds a line break every 76 characters.

How can I calculate this for my own file?+

Use the Base64 Size Calculator to enter a byte count or paste text and see the exact encoded size and overhead percentage.