Skip to content
ToolsMastar

Convert an Image to a Data URI

Turn an image into a data URI with ready-to-paste HTML and CSS snippets.

Input:
JPG, PNG, WEBP, GIF, SVG, AVIF
Output:
TXT
Max size:
50 MB
Runs:
In your browser (no upload)

What the Image to Data URI does

Turn a small image into a data URI and get ready-to-paste HTML img and CSS background snippets, so icons can be embedded without an extra request.

Good to know

Data URIs are about a third larger than the file; use them for small icons only.

How to use the Image to Data URI

  1. 1

    Drag your JPG, PNG, WEBP, GIF, SVG, AVIF file into the upload area, or click it to browse your device.

  2. 2

    Adjust the options to suit your needs — the defaults work well for most files.

  3. 3

    Click “Run Image to Data URI” to start processing.

  4. 4

    Preview the result, then download it. Batch results can be downloaded together as a ZIP.

Supported formats

  • JPG (JPEG) is a lossy format ideal for photographs. It has no transparency and is supported everywhere. More about the JPEG / JPG format.
  • PNG is a lossless format that supports full transparency. Best for screenshots, logos and graphics with sharp edges. More about the PNG format.
  • WebP is a modern format from Google supporting lossy and lossless compression plus transparency, typically 25–35% smaller than JPG. More about the WebP format.
  • GIF supports simple animation and up to 256 colors per frame. It is universally supported but produces large files. More about the GIF format.
  • SVG is an XML-based vector format that scales to any size without losing sharpness. More about the SVG format.
  • AVIF is a next-generation format based on the AV1 codec, offering excellent compression and HDR support. More about the AVIF format.

Frequently asked questions