What a data URI actually is#
A data URI embeds a file's content directly inside a string, instead of pointing to it with a URL — data:image/png;base64,iVBORw0KG... is a complete, self-contained image with no separate HTTP request needed to load it. It works anywhere a normal image URL works: a CSS background-image, an <img src> attribute, or an background in an email template that cannot rely on external image loading.
The real trade-off: fewer requests, more bytes#
Base64 encoding turns every 3 bytes of binary data into 4 characters of text — about 33% larger than the original file, before any HTML/CSS surrounding it. Inlining a small icon or a tiny sprite eliminates a separate network request, which can be a net win; inlining a large photo just bloats the HTML or CSS file it lives in and defeats the browser's own image caching. This tool shows both sizes side by side so that trade-off is visible before deciding whether to inline something.
Why the image never leaves your browser#
The conversion uses the FileReader API built into every browser, which reads the file from disk and encodes it locally — there is no upload step, so this works for private or unpublished images without exposing them anywhere. That also makes it fast: nothing waits on a network round trip.