EIT easy-image-tools / Build a data URI from an image

Build a data URI from an image

Builds a full data-uri (data:image/png;base64,…) for embedding in HTML/CSS.

01

Build a data URI from an image

Nothing found — try another word.

This tool has no parameters — the result is ready as is.

Preview
Source
Drop a PNG here or click / paste (Ctrl+V) — processed locally
Result
no result yet

Build a data URI takes an image and produces the complete string that lets it live inside a text file: the data: prefix, the media type, the base64 marker, a comma and the encoded picture — ready to paste into a background-image declaration, an HTML src attribute, a JSON config or an email template, with a button that copies the whole value. The encoding always produces a PNG, whatever you loaded, because the pixels are re-encoded through a canvas: a JPG or WebP comes back as PNG bytes inside the data URI. Everything runs in your browser.

  • Encoded entirely in your browser: the image and the string never leave the page.
  • Complete value with prefix — the payload alone is the Base64 tool.
  • The output is always image/png, whatever format went in.
  • Base64 costs about a third more characters than the raw bytes.
  • Free with no daily limit, no watermark and no account, also for commercial use.

How to use it

  1. Drop the image into the source area, or pick a file from your device.
  2. Wait for the full data:image/png;base64,... string to appear in the result panel.
  3. Press the copy button to take the whole value, prefix included.
  4. Paste it into a background-image declaration, a src attribute or a JSON config.

Questions

How is this different from the Base64 string?

The Base64 output is only the payload. The data URI adds the data: prefix, the image/png media type and the comma, which an attribute expects as a whole. The data URI to PNG page here does the reverse.

Does it stay a PNG if I upload a JPG?

Yes, and that is worth knowing: the pixels are encoded again as a PNG, so the data URI always says image/png and carries PNG data.

Why is the string so much longer than the file?

Base64 stores six bits per character, so it costs about a third more characters than the raw bytes. It is a transport format, not a compression one.

Is the string uploaded anywhere?

No. The image is read, encoded and displayed in your browser tab, and no copy is stored - which matters because a data URI contains the whole picture.

Related tools