tools.now

Image to Base64

Encode an image as Base64 to embed it directly in HTML, CSS, JSON or an email template. The file is read locally and its bytes are not changed.

🔒 Runs in your browser. Your data is never uploaded.

How to use

  1. Drop an image or click to choose one.
  2. Pick the output: a data URI, plain Base64, a CSS background rule or an HTML img tag.
  3. Click Convert and copy the text.

When inlining helps, and when it hurts

A Base64 image is about 33% larger than the file and cannot be cached separately from the page that contains it. Inlining pays off for small images of a few kilobytes, such as icons, where it saves a request. For photos, a normal image file is faster.

Frequently asked questions

What is a data URI?
A URL that contains the file itself: data:image/png;base64, followed by the encoded bytes. Browsers accept it anywhere an image URL is allowed.
Does encoding change image quality?
No. Base64 represents exactly the same bytes as text. Decoding it gives back the identical file.
Is there a size limit?
Browsers handle data URIs of many megabytes, but such pages load slowly. Compress the image first and keep inlined images small.

Related tools