Skip to content

Image Tools

Image to Base64

Handy for embedding small images directly in CSS, HTML, or JSON without a separate file request.

  • Free
  • No sign-up
  • Runs in your browser

Guide

What does converting an image to Base64 do?

Base64 is a way of writing binary data, such as an image file, using only ordinary text characters. The result here is a data URL, which starts with a prefix like data:image/png;base64, followed by the encoded content.

A data URL can be pasted straight into HTML or CSS as an image source, so the picture is carried inside the code rather than loaded from a separate file.

Base64 encoding makes data larger, because every 3 bytes of the image become 4 text characters. Expect the string to be roughly a third bigger than the original file.

When embedding an image as text makes sense

Embedding works well for small assets: a tiny icon in a stylesheet, a logo inside an HTML email template, or a placeholder image in a code sample. It removes one network request and keeps everything in a single file.

It is a poor choice for large photos, because the larger text string bloats your page and cannot be cached separately by the browser. If an image is big, compress it first with the image compressor before encoding.

When you need to check a string or turn it back into a picture, use the Base64 to image tool.

How to convert an image to Base64

  1. Drag an image onto the drop area, or click it to choose a file. Any image type your browser accepts is allowed.
  2. The tool reads the file locally and shows a small preview along with the full data URL in a text box.
  3. Click Copy Base64 to copy the whole string. The button changes to Copied for a moment.

Only the first file is used if you select several.

A short example of how it is used: paste the copied string into an img tag as src="data:image/png;base64,..." (with the full string in place of the dots) and the image renders without a separate file. Everything is processed in your browser, and the file is not uploaded.

Practical limits and tips

The output is the full data URL, including the data:image/...;base64, prefix. Some APIs and configuration files want only the raw Base64 part after the comma, so remove the prefix by hand if needed.

The text box is read-only and there is no download button, only copy. Very large images produce very long strings, which can be slow to paste or may exceed limits in the place you are using them.

Keep the original file as well. A Base64 string is awkward to edit, and converting an already compressed or resized image is better than encoding a heavy original.

Frequently asked questions

Is my image uploaded when I convert it?

No. The file is read in your browser and encoded locally. The image is not sent to a server by this tool.

Why is the Base64 text so long?

Base64 stores every 3 bytes as 4 characters, so the text is about a third larger than the file, and image files hold many thousands of bytes. Smaller or compressed images give shorter strings.

Does the output include the data:image prefix?

Yes, the box shows the complete data URL. If you need only the encoded part, delete everything up to and including the comma.