Skip to content

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

  1. Drop a picture in the box above, or tap to choose one.
  2. Pick the form you need: data URI, raw Base64, CSS or HTML.
  3. Press Copy and paste it into your code.

When Base64 helps, and when it does not

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.