Image to Base64 converter

Converting an image to Base64 encodes its bytes as text so it can be embedded directly in HTML, CSS or JSON.

Features

  • Four formatsData URL, plain Base64, img tag or CSS background.
  • Size shownCompare the file size with the text length.
  • Runs on your deviceYour data is processed in the browser and is never uploaded.

How to use the Image to Base64

  1. Choose or drop an image.
  2. Pick an output format.
  3. Copy it.

When to embed

Embedding saves a request for tiny icons, but Base64 is about a third larger and cannot be cached separately.

Make a data URL in JavaScript

const reader = new FileReader();
reader.onload = () => console.log(reader.result); // data:image/png;base64,…
reader.readAsDataURL(file);

Frequently asked questions

What is the size limit?

5 MB.

Is image quality changed?

No. The bytes are encoded as they are.

Does it work with SVG?

Yes.

Related tools