How to use the result
Click “Choose file”, keep “As data: URI” ticked, and copy the output. A data URI can go anywhere a normal image address can.
<img src="data:image/png;base64,iVBORw0KGgo..." alt="Logo">
.icon { background-image: url(data:image/png;base64,iVBORw0KGgo...); }
{ "avatar": "iVBORw0KGgo..." } // untick the option for a bare stringWhen embedding an image is worth it
| Good fit | Poor fit |
|---|---|
| Icons and small logos of a few kilobytes | Photos and anything above about 10 KB |
| HTML emails and single-file documents that must work offline | Images reused on many pages, which a browser would otherwise cache once |
| Sending an image inside JSON to an API | Pages where load speed matters and the HTML is already large |
Base64 makes the data about 33% larger, and an embedded image cannot be cached separately from the page that contains it. The size line under the tool shows the exact increase for your file.
Questions
Is my image uploaded?
No. The browser reads the file from your disk and converts it in memory.
Which MIME type is written into the data URI?
The type your system reports for the file, or the type recognised from the file's first bytes when none is reported.
Can I embed an SVG this way?
Yes, though for SVG a URL-encoded data URI is usually shorter than Base64, because SVG is already text.