Skip to content

Image to Base64 Converter

Turn an image into a Base64 string you can paste into code, JSON or a database field.

How to use the Image to Base64 Converter

  1. Add an image file.
  2. Press Encode.
  3. Copy the Base64 string from the result box.

What Base64 encoding does

Base64 rewrites binary data using 64 printable characters, so an image can travel through channels that only accept text — a JSON payload, an HTML attribute, a YAML file or a text column in a database. Nothing is compressed or lost; the encoding is fully reversible.

The size trade-off

Base64 makes data roughly 33% larger, because three bytes become four characters. That is acceptable for small assets and wasteful for large ones. Encoding tiny icons directly into a stylesheet removes a network request, which can be a net win; encoding a 2 MB photograph into a page is almost always a mistake.

Base64 string or data URI?

This tool gives you the raw Base64 payload. If you want a value you can drop straight into an src attribute or a CSS url(), use the Image to Data URI converter instead, which adds the data: prefix and MIME type.

Frequently asked questions

Is any quality lost?
No. Base64 is a reversible text encoding, not a compression method. Decoding gives back the identical file.
Why is the string so long?
Base64 output is about a third larger than the original file. Long strings are normal, especially for photographs.
How do I use it in HTML?
You need the data URI form — use the Image to Data URI converter, which prefixes the string with the MIME type so it works directly in an src attribute.