Image to Base64
Convert an image into a data URI you can paste straight into HTML or CSS, with a warning when the result is large enough to be a bad idea.
Runs entirely in your browser. Nothing is uploaded.
Drop an image here
Small images only — inlining a large one makes the page slower, not faster.
Processed in your browser. Nothing is uploaded.
About the Image to Base64
A data URI puts the image inside the document instead of pointing at a separate file. That removes a network request, which is occasionally worth doing — a tiny icon inlined into a stylesheet, an image embedded in an email template where external references get blocked, a placeholder that must survive with no server behind it.
It is worth doing far less often than people assume, and the reason is arithmetic. Base64 represents three bytes using four characters, so an encoded image is about thirty-three percent larger than the file it came from. That inflated version goes into your HTML or CSS, which means it cannot be cached separately, cannot be loaded lazily, and blocks rendering if it sits in a stylesheet. A 200 kB photograph becomes 270 kB of text in the critical path, which is a clear loss against one extra request that the browser would have made in parallel anyway.
The rule of thumb is a few kilobytes. Under that, saving a request is usually worth the overhead. Above it, the overhead wins and a normal file reference is better. This tool shows both sizes and says which side of the line you are on rather than leaving you to work it out.
For simple icons an SVG is almost always better than a base64 raster: it is smaller, it scales, it can inherit colour from CSS, and it can be inlined as readable markup rather than an opaque wall of characters.
The encoding happens in your browser and the image is never uploaded.
Frequently asked questions
Why is the data URI bigger than my file?
Because Base64 uses four characters for every three bytes, adding about a third. That inflated version goes straight into your HTML or CSS.
When should I actually inline an image?
When it is a few kilobytes or less, or when external references will be blocked — email templates, for instance. Above that the size penalty and the loss of separate caching outweigh saving one request.
Is an SVG better for icons?
Almost always. It is smaller, it scales, it can take its colour from CSS, and it inlines as readable markup rather than an opaque block of characters.
You might also need
- Developer
Base64 Encoder & Decoder
Encode and decode Base64, including the URL-safe variant, with full Unicode support.
- Image
QR Code Generator
Make QR codes for links, wifi, contacts and more, as PNG or SVG.
- Image
Image to ASCII Art
Turn a picture into text art, with charset and width controls and a PNG export.