Image to Base64
Turn an image into a Base64 data URL, CSS background or HTML img tag.
Drop images here
PNG, JPG, WebP, GIF or SVG — one or many
Files are processed on this device. Nothing is uploaded.
How to use Image to Base64
- Drop an image or choose one from your device.
- Copy the format you need: data URL, raw Base64, CSS background or HTML tag.
- Paste it into your code.
How it works
A data URL embeds the file directly in HTML or CSS (data:image/png;base64,…), saving an HTTP request for very small images such as icons. The file is read with the browser’s FileReader and never uploaded.
Base64 makes files about 33% larger, and embedded images cannot be cached separately, so use data URLs only for small assets (a few kilobytes). For larger images, serve normal files and use Compress Image instead.
Frequently asked questions
When should I use a data URL?
For tiny images used once, like an icon in CSS or an email signature. Larger images are better served as files.
Does SVG need Base64?
Not always. SVG can be URL-encoded instead, which is often smaller; Base64 works everywhere, though.
Is my image uploaded?
No. It is read and encoded locally.
Is there a size limit?
No hard limit, but data URLs over a few hundred kilobytes slow down pages and some email clients reject them.
Limitations
- Very large images create very long strings that can slow the browser when copied.
- Some email clients block data-URL images.
Last reviewed November 9, 2026. How we build and test tools.