top of page

Image to Base64

Turn a small image into text you can paste straight into HTML, CSS or JSON. You get the data URI, the raw Base64, a CSS rule and an img tag, each with a Copy button. It runs in your browser, so the image stays on your device.

How to use it

  1. Add an image.
  2. Wait a moment while it is encoded.
  3. Copy the data URI, Base64, CSS or HTML snippet you need.

Frequently asked questions

What is a Base64 data URI?

It is the image itself written as text, starting with data:image/png;base64, followed by the encoded bytes. A browser can show it without fetching a separate file.

When should I use Base64 images?

They suit tiny images such as icons, because they save a request and travel with the page. They are a poor fit for large photos: Base64 text is about a third bigger than the file, and the browser cannot cache the picture separately.

Why do I see a warning about size?

Above roughly 1 MB of text, a data URI starts to slow pages down. Compress or resize the image first, or link to a normal image file instead.

What is the difference between the four outputs?

The data URI is the complete value. Raw Base64 leaves off the data: prefix, which suits APIs and JSON. The CSS output is a background-image rule, and the HTML output is an img tag with an empty alt that you can fill in.

Which images work, and are they changed?

JPG, PNG, WebP, GIF and BMP up to 25 MB. The original file is encoded byte for byte, so camera data inside a photo comes along. Use Remove Image Metadata first if you do not want that.

Is my image uploaded to a server?

No. The work happens inside your browser, on your own device. Your files are not sent anywhere, there is no account, and there is nothing to delete afterwards.

More free tools

Compress Image | Convert Image | Remove Image Metadata | Resize Image

bottom of page