How to convert an image to Base64
- Drop in an image.
- Copy whichever output you need: data URI, HTML or CSS.
- To decode, paste a Base64 string or data URI into the decoder box and click Decode & Preview.
Embedding images in HTML and CSS
Turning a small image into Base64 lets you put it straight into your HTML or CSS, with no separate file to host. Handy for tiny icons, email templates, or a quick prototype.
Drop an image in and you get three versions to copy: the raw data URI, a ready-made <img> tag, and a CSS background-image line. It also works the other way. Paste a Base64 string and you can preview the image and download it.
Frequently asked questions
Should I Base64 all my images?
Please don't. Base64 makes a file about a third bigger, and the browser can't cache it separately. It's worth it for small things like icons. For photos, link to a normal file.
My decoded image won't show up
Check that the whole string got pasted. Long strings often get cut off when copied. It's fine to include the "data:image/png;base64," part at the start, or to leave it off.