Image to Base64

Encode any image as a base64 data URI for embedding.

How to use this tool

  • Drop an image (or choose format for output).
  • See the data URI preview, with length.
  • Copy the full string or pre-formatted HTML/CSS snippet.

How it works

The file is read and base64-encoded via FileReader (plus an optional canvas re-encode for format control); the URI is assembled with its MIME type.

Tips

  • Convert small files first — encoded text is ~33% larger than the binary.
  • Compress the image before encoding to keep the URI lean.

Limitations

Very large images produce very long strings that bloat pages — resize first.

Frequently asked questions

What is a data URI?

A string that embeds the file directly in HTML/CSS (data:image/png;base64,...) so no separate file request is needed.

When should I use base64 images?

For small assets (icons, tiny previews) and single-file HTML documents — not for photos (they inflate the HTML).

Is the encoding private?

Yes — it all happens locally in your browser.