Skip to content

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.

Choose files or drag and drop them into the upload field. Maximum file size: 5 MB.

Reset

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.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.