99digest is in early access — tools are free while we grow.
Guide

How to Convert an Image to a Base64 Data URL

Sometimes you need a picture inside a single file: an HTML email, a CSS rule or a quick demo. A data URL embeds the image as text.

What you get

The Image to Base64 tool outputs a data URL that starts with data:image/png;base64, followed by the encoded picture. Use it as an image source or a CSS background: <img src="data:image/png;base64,...">.

Using the tool

  1. Choose an image, up to 25 MB.
  2. Copy or download the data URL.
  3. Paste it where a file address would go.

The encoding happens in your browser, so the image is not uploaded.

The cost

Base64 makes data about a third larger, and the browser cannot cache an embedded image separately from the page that holds it. So it is a good idea for tiny icons and one-off files, and a bad one for photos. Compress or resize first with the compressor if you must embed something large.

Good uses

  • Small icons in CSS, saving an extra request.
  • HTML emails, where linked images are often blocked.
  • Self-contained demos and test files.

Frequently asked questions

Does it work for any image format?

It encodes common image files as they are, so the data URL keeps the original format. SVG, PNG, JPEG, WebP and GIF are all fine.

What is Base64?

An encoding that writes bytes as text. See how to encode and decode Base64.

Try the Image to Base64 Free, instant, and runs in your browser.