Skip to content

Image to Data URI Converter

Generate a complete data: URI you can paste straight into an img tag or a CSS background.

How to use the Image to Data URI Converter

  1. Add an image file.
  2. Press Encode.
  3. Copy the data URI and paste it into your HTML or CSS.

What a data URI contains

A data URI packs the MIME type and the Base64 payload into a single string beginning with data:. Because the image is embedded in the markup, the browser does not make a separate request for it.

When embedding is worth it

Small assets benefit: an icon of a few hundred bytes saves a round trip and appears instantly. Larger images do not. Embedded data cannot be cached separately from the page, so a big data URI is re-downloaded with every HTML response and blocks the page from rendering for longer. A practical cut-off is a few kilobytes.

Usage examples

In HTML: <img src="data:image/png;base64,...">. In CSS: background-image: url("data:image/png;base64,..."). For SVG, embedding the markup directly is usually smaller than Base64.

Frequently asked questions

How is this different from plain Base64?
A data URI is the Base64 payload plus the data: prefix and MIME type, which is what browsers need in an src or url() value.
Does this make my page faster?
For very small images, yes — one fewer request. For large images it makes things worse, because the data cannot be cached separately from the HTML.