When Inline Data URIs Help—and When External Files Win
Embedding a micro-asset directly inside HTML or CSS as a data: URI eliminates an extra network fetch and prevents brief flashes of missing UI chrome (such as custom select chevrons, custom cursors, or standalone single-file HTML exports).
Encoding Math: 3 Octets → 4 Sextets
Binary Input: 3 bytes x 8 bits = 24 bits
Base64 Output: 4 chars x 6 bits = 24 bits
Byte Ratio: 4 / 3 = 1.333x (+33.3% raw byte overhead)
Under HTTP/2 and HTTP/3 connection multiplexing, anything larger than a few kilobytes loads faster and caches cleanly as a standalone .webp or .svg asset. Read our full comparison in Data URIs & Base64 Inlining vs HTTP/3 Caching.
Frequently Asked Questions
Why does Base64 always add ~33% to raw file size?
Base64 maps every 3 bytes (24 bits) of binary input into 4 printable 6-bit ASCII characters (4 / 3 = 1.3333). That 33.3% text expansion applies to every binary image encoded as Base64.
What is the safe size threshold for inlining Base64 images?
Keep Base64 Data URIs under 2 KB to 4 KB (and strictly below 10 KB)—ideal for tiny UI cursors, checkboxes, HTML email icons, or single-file offline HTML reports.
Why shouldn't I Base64-encode hero photos or large illustrations?
Large Base64 strings bloat render-blocking CSS or HTML, cannot be cached separately from the document, and force main-thread string-to-binary decoding before image paint.
For SVG icons in CSS, is URL-encoding smaller than Base64?
Often yes—minimal UTF-8 percent-encoded data:image/svg+xml Data URIs avoid the 33% Base64 expansion and compress better under Brotli.