# Image to Data URI

Convert an image into a data URI that you can paste straight into HTML, CSS or JSON, with ready-made img tag and CSS background snippets. SVG files are URL-encoded instead of base64, which keeps them smaller.

## Frequently asked questions

### What is a data URI?

A URL that contains the file itself, such as data:image/png;base64,... Browsers display it like an image file, without a separate request.

### When should I inline images?

For small images such as icons and tiny backgrounds, where saving a request matters more than size. Base64 makes files about a third larger and they cannot be cached separately, so keep large images as files.

### Why are SVGs not base64-encoded?

SVG is text, so URL-encoding only the few characters that need it is shorter than base64 and keeps the result readable.

### How large can the image be?

Up to 1 MB. The tool warns when the data URI gets longer than 10,000 characters, a sign that a separate file may be better.

### Which formats work?

PNG, JPEG, GIF, WebP, AVIF, TIFF and SVG. The MIME type is detected from the file contents.

### Does the HTML snippet include the size?

Yes, for bitmap images the width and height attributes are added, which prevents layout shifts. Add a meaningful alt text before using it.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
