Image to Base64 Converter

Turn an image into a Base64 data URI to paste into HTML, CSS or JSON, or turn Base64 back into an image.

Runs in your browser. Nothing is uploaded.

Drop an image here or tap to choose

PNG, JPG, WebP, GIF, SVG and ICO.

Report a problem with this tool

How to convert an image to Base64

  1. Drop an image into the box, or tap it to choose one.
  2. Pick the format you need: a full data URI, plain Base64, an HTML img tag or a CSS background rule.
  3. Click Copy and paste it into your code.

To go the other way, choose Base64 to image, paste the text, and download the picture. Both a full data URI and plain Base64 work.

When to embed images as Base64

A data URI puts the image inside your HTML or CSS, so the browser doesn't have to fetch a separate file. That suits small icons, logos in HTML emails and images inside JSON. Base64 makes the image about a third larger, though, and embedded images can't be cached on their own, so keep normal image files for anything over a few kilobytes.

Frequently asked questions

Is my image uploaded?

No. The image is read and encoded in your browser, so it never leaves your device.

Why is the Base64 bigger than my image?

Base64 uses 4 characters for every 3 bytes of data, so the text is about 33% larger than the original file.

Do data URIs work in all email apps?

Most webmail and phone apps show them, but some desktop versions of Outlook don't. For important emails, attach the image or host it online instead.

More free tools