Image to Base64 Converter

Convert an image to a Base64 data URI, with ready-to-paste HTML and CSS code.

What is a Base64 image?

A Base64 image is a picture encoded as text in a data URI, such as data:image/png;base64,iVBOR… It can be embedded directly in HTML, CSS or JSON instead of being loaded as a separate file.

When to use Base64 images

  • Tiny icons and logos in HTML emails, where external images are often blocked.
  • Small images inside CSS to avoid an extra request.
  • Embedding images in JSON or a single-file HTML document.

When not to

Base64 makes files about 33 % larger and cannot be cached separately, so keep it for images under a few kilobytes. Normal image files with good caching are better for photos.

The tool gives you the data URI, an <img> tag and a CSS background-image rule. Decode Base64 back to a file with the Base64 to Image Converter.

Frequently asked questions

Why is the Base64 string bigger than the image?

Base64 encodes 3 bytes as 4 text characters, which adds about 33 %.

Is there a size limit?

Images up to 10 MB can be encoded, but small images are recommended.

Is my image uploaded?

No, encoding happens in your browser.