About the Image to Base64
A data URI (RFC 2397) embeds a file directly in HTML or CSS: data:image/png;base64,iVBORw0KGgo…. The browser decodes it without an extra HTTP request, which suits small icons, email templates and single-file demos. The cost is size: Base64 adds about 33%, the image cannot be cached separately and large inline images delay parsing of the document, so keep inlined assets to a few kilobytes.
This tool reads the file with the File API, detects the MIME type (from the file or its magic bytes), and shows the original size, the data URI size and the pixel dimensions. The <img> snippet includes width and height so the page does not shift while it loads.
In decode mode, paste a full data URI or bare Base64. The format is recognised from the first bytes (PNG 89 50 4E 47, JPEG FF D8 FF, GIF, WebP, AVIF, BMP, ICO or SVG markup) and you can download the result with the correct extension. For SVG, a URL-encoded data URI is often smaller than Base64; both forms are accepted when decoding.
How to use it
- Drop an image on the box or click “choose a file”.
- Copy the data URI, raw Base64, CSS rule or <img> tag.
- To go the other way, switch to “Base64 → Image” and paste a data URI.
- Check the preview, then click Download to save the image.
Frequently asked questions
When should I inline an image as a data URI?
Why is the Base64 string bigger than my file?
Is my image uploaded to a server?
How do I use a data URI in CSS?
background-image: url("data:image/png;base64,…");. The CSS output box gives you a ready rule.