Image to Base64 converter

Turn an image into a Base64 data URI you can paste into CSS, HTML, JSON or email templates. It also works the other way: paste Base64 and you see the image and can save it as a file.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Add an imageOpen an image, drop it onto the input box, or paste Base64 or a data URI.
  2. Choose the outputPick data URI, Base64, CSS, HTML or Markdown. The preview shows the image and its size.
  3. Copy or downloadCopy the code with one click, or download the image as a file.

Why embed images as Base64?

A data URI puts the image right inside your code, so the browser does not need a separate request for it. That is handy for small icons in CSS, images in HTML email templates, single file HTML pages and images stored in JSON or a database field.

Base64 makes the data about a third larger, so it is best for small images. The tool shows the exact size and warns you when an image is big enough to slow a page down.

Ready to paste code

Instead of building the code by hand, choose the format you need. The CSS option gives a complete background-image line, the HTML option an img tag with width and height so the page does not jump while loading, and Markdown an image link for README files.

Frequently asked questions

Is my image uploaded?

No. The image is read and converted in your browser and never sent to our servers.

Is there a size limit?

There is no fixed limit, but data URIs over about 100 KB make pages and stylesheets heavy. For large images a normal image file is the better choice.

Can I convert other files, like PDFs or fonts?

Yes. Any file becomes a data URI or plain Base64. The CSS, HTML and Markdown options are only offered for images.

How do I turn Base64 back into an image?

Paste the Base64 text or data URI into the input box. The image is shown right away and Download saves it with the right file extension.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.