Image to Base64
Drop a picture and get its Base64 text, ready to paste as a data URI, a CSS background or an HTML image. It all happens on your device.
How to convert an image to Base64
- Drop a picture in the box above, or tap to choose one.
- Pick the form you need: data URI, raw Base64, CSS or HTML.
- Press Copy and paste it into your code.
When Base64 helps, and when it does not
- Good for small icons, logos and one-off pictures in an HTML email or a single-file page: one request less.
- Not good for photos: the text is a third bigger than the file, the browser cannot keep it in its picture cache, and it makes the page file heavy.
- Keep it small: resize or compress with the image compressor or the image resizer before you convert.
To turn Base64 text back into a picture, use Base64 to Image. Working with data in code too? The JSON formatter tidies the file that holds it.
Frequently asked questions
What does image to Base64 mean?
Base64 writes the bytes of a picture as plain text. The text can sit inside HTML, CSS, JSON or an email, so the page does not need a separate image file.
What is a data URI?
It is the Base64 text with a short start that names the picture type, like data:image/png;base64,… . A browser can show it as if it were a link to an image. Use the "Data URI" choice for a src or url() value.
Does Base64 make my image smaller?
No, it makes it bigger: about one third more than the file. That is fine for a tiny icon, but a big picture inside a page makes the page slower. Shrink it first with the image compressor.
How do I use the CSS and HTML choices?
Copy the CSS line into a style rule (it sets background-image), or the HTML line into your page (it is a ready img tag). Add a real alt text to the img tag if the picture carries meaning.
Which pictures can I convert?
PNG, JPG, WebP, GIF, BMP, ICO and SVG, up to 20 MB. The type is found from the file itself, not from its name, so a wrongly named file still gets the right data URI.
Is my image uploaded?
No. The file is read and turned into text in your browser, on your device. Nothing is sent to a server.
More image tools
Image compressor
Make JPG, PNG and WebP photos smaller without visible loss.
Compress image to 20 KB
Get a photo or signature under 20 KB for online forms.
Compress image to 50 KB
Get a photo under 50 KB for job and exam forms.
Compress image to 100 KB
Get any photo under 100 KB in one step.
Compress image to 200 KB
Get a photo or scan under 200 KB.
MM to pixel converter
Turn a size in mm, cm or inches into pixels at a DPI, or pixels into mm. A4 and photo sizes ready.