Why Base64 Needs Four Characters for Three Bytes

Computers store images, audio, and other files as bytes—values that can include any of 256 possibilities. A text-only channel may not safely preserve every possible byte. Base64 avoids that problem by translating the data into a restricted alphabet of 64 text characters, plus padding when needed.

The conversion works in groups: Base64 reads three bytes, treats them as 24 bits, and splits those bits into four six-bit values. Each value maps to one printable character. The original 24 bits therefore take 32 bits’ worth of characters: a 4-to-3 expansion, or about 33% more before any later compression.

The Extra Size Can Travel With the Data

When a file is embedded directly in text—such as an image inside a data URL or an attachment represented in a text-based message—the Base64 characters become part of the transmitted content. The receiver must decode them back into the original bytes. For a large file, carrying roughly one-third more data can mean a larger message and more time or bandwidth to move it.

That increase is not always the final size penalty. Text compressors often find repeated patterns in Base64 and can shrink it, sometimes narrowing the gap. But compression is not guaranteed to erase the overhead, and Base64 adds processing and makes the content harder for people to inspect.

A Compatibility Tradeoff, Not a Better File Format

Base64 is useful when a system expects text and changing that system to handle raw binary data is inconvenient. It does not make the underlying file smaller or more secure; it simply gives the bytes a text-safe representation. When a channel supports binary files directly, sending the original bytes usually avoids the Base64 expansion.