Image to Base64

Turn an image into a Base64 data URI.

Looking for the Base64 to image converter?

Output

Runs in your browser. Nothing uploaded.

How to convert an image to Base64

  1. Drop an image into the box, choose a file, or paste a screenshot.
  2. Pick the output: a full data URI, bare Base64, a CSS background rule or an HTML image tag.
  3. Click Copy and paste it into your code.

Using the result

In HTML, paste the data URI into an image tag: <img src="data:image/png;base64,iVBOR..." alt="Logo">. In CSS, use it as a background: background-image: url("data:image/png;base64,iVBOR..."). Emails, single-file HTML reports and JSON payloads are other common places for inline images.

SVG is a special case

SVG files are text already, so they also work in a data URI without Base64, which is often smaller. Base64 is still the safer choice when the SVG contains quotes or symbols that would need escaping.