Skip to the tool

HomeHow-to guides

How to convert an image to Base64 (and back)

Quick answer

To convert an image to Base64, drop it into the Image to Base64 tool and copy the result. The default is a data URI you can paste into HTML or CSS. To go back, choose Base64 to image, paste the text and download the picture.

Open Image to Base64

Steps

  1. Open the Image to Base64 tool and choose Image to Base64.
  2. Drop in the picture. The original file is encoded as it is, so an SVG stays an SVG.
  3. Pick the format you need: a data URI, plain Base64, a CSS background or an HTML image tag, then press Copy.
  4. To decode, choose Base64 to image, paste the text and download the picture.

When Base64 is a good idea

Base64 writes the bytes of a file as plain text, so a small picture can sit inside a web page, a stylesheet or an email without a separate file. The text is about a third longer than the file.

It suits small images such as icons and logos. For a large photo the text becomes very long and a normal image file loads faster, so the tool warns you above 100 KB.

Pasting Base64 back

You can paste a full data URI or just the Base64 characters. The tool reads the picture type from the data itself (PNG, JPG, GIF, WebP, BMP, AVIF, SVG or ICO) and trusts that over a wrong label.

If the text was cut off when it was copied, or is not a picture, you get a plain message saying so instead of a broken download.

Common questions

What is a data URI?

A way to put a file inside a web address. It starts with data:, the file type and ;base64, followed by the Base64 text.

Why is the Base64 text bigger than the file?

Base64 uses four text characters for every three bytes, so the text is about 33 percent longer.

Is my picture uploaded?

No. Encoding and decoding happen in your browser.

Written by Basic App Company. Last checked against the tool on 12 Nov 2026. The tool runs in your browser, so your pictures are not uploaded.

All how-to guides