Home / Image tools / Image to Base64
Image to Base64
A data URL puts the image inside the markup, so the page makes no extra request for it. Choose a file and copy the string — it never leaves your device, which matters for anything unpublished.
How to use it
- Choose an image file.
- Check the preview and the size comparison.
- Copy the data URL into your src or your CSS.
Examples
- A 2 KB icon becomes a short data URL that loads with the page.
- Paste it into an img tag's src, or into url() in a stylesheet.
- Encoded output is roughly a third larger than the original file.
Questions people ask
When is this a bad idea?
For anything over a few kilobytes. Embedded images cannot be cached separately, so a large data URL is re-downloaded with every page and inflates the HTML. Keep it for small icons and one-off graphics.
Does it work with SVG?
Yes, and for SVG a data URL is often the better choice because the file is small and text-based. Encoding also sidesteps escaping problems when embedding SVG directly in CSS.
Related tools
Updated: 2026-08-07