Image to Base64 (Data URI)

Convert an image to text you can paste directly into CSS or HTML, with no separate file to host. The reverse works too.

Drop an image here or click to choose it. JPEG, PNG, WebP, GIF, BMP, SVG.

Image to Base64 is a free tool that runs entirely in your browser, with no data ever sent to a server. Convert an image to text to paste into CSS or HTML, and the other way around.

What an image in Base64 is for

A data URI encodes an image directly in a page's text, with no separate request to a file. Useful for a small logo in an email, an icon embedded in a CSS file, or a favicon defined inline with no external file.

The cost

Base64 encoding represents every group of 3 bytes with 4 characters: the resulting text weighs about 33% more than the original binary file. On a photo of several hundred kilobytes, the page embedding it becomes noticeably heavier than with a separate file, which the browser could have cached independently.

What this tool does not do

This tool does not read HEIC photos (the default on some iPhones): convert them to JPEG from the device first. On a PNG, compression changes the format rather than truly reducing the size, since the browser cannot produce a reduced-palette PNG.

Frequently asked questions

Can I rebuild an image from Base64 text alone, without the data:image/… header?

Yes. Paste the text, choose the image type from the list, then run the rebuild.

Does SVG work too?

An SVG dropped in is treated like a regular bitmap image: it's encoded as is, but the resulting text does not preserve the file's vector nature when read back.

Are my files sent to a server?

No: processing happens entirely in your browser, on your device. No file is ever transmitted to a server, at any point.