Image to Base64 Converter

Turn a picture into text you can paste into HTML, CSS or JSON, and turn it back again.

Loading tool…

  • Free
  • No sign-up
  • Runs in your browser
  • Files never uploaded

How to use the image to base64

  1. Add an image to encode it.
  2. Copy the result as a data URI, raw Base64, an <img> tag or a CSS background rule.
  3. To go the other way, paste Base64 into the lower box and press Decode to image.

What is Base64?

Base64 writes binary data using only 64 safe text characters. Encoding an image this way lets you embed it directly inside an HTML page, a stylesheet, an email or a JSON payload instead of linking to a separate file.

When embedding makes sense

  • Small icons and logos in a single-file HTML page or email template.
  • Images in JSON APIs or configuration files that can only hold text.
  • Tiny CSS background images where saving a network request matters.

When it does not

Base64 makes data about 33% larger and embedded images cannot be cached separately by the browser. For anything over a few kilobytes, a normal image file is faster. Shrink the image first with the image compressor if you do embed it.

Frequently asked questions

What is a data URI?

It is the Base64 text with a short prefix such as data:image/png;base64, that tells the browser what kind of file follows. You can use it anywhere a normal image URL is accepted.

Is my photo uploaded to a server?

No. The work is done by your own browser using JavaScript, so the picture never leaves your phone or computer. You can even switch off your internet connection after the page loads and the tool keeps working.

Related tools