Convert image to Base64

Get the Base64 code of an image ready to paste into HTML, CSS or JSON.

Processed on your device. No file is uploaded.

Drag your file here

or

JPG, PNG, WebP, AVIF

How to use Image to Base64

  1. Choose the image.
  2. Pick the format: Data URI, Base64 only, <img> or CSS.
  3. Copy the result or download it as .txt.

What converting an image to Base64 is for

Base64 turns the image into text. That way it can be embedded directly inside an HTML file, a stylesheet, an email template or a JSON, without relying on a separate image file.

It is common for small icons, logos in email signatures, development tests and APIs that receive images as text.

Tips for a better result

  • Use it for small images (under 10-20 KB); large ones are better linked.
  • Compress the image first with "Compress images" to get shorter code.

Formats

Input
JPG, PNG, WebP, AVIF
Output
Base64 / Data URI

Keep in mind

  • Base64 text takes about 33% more space than the original image.

Privacy

The file is processed on your device by your own browser. It is not sent to any server and no copy is kept. More details.

Frequently asked questions

What is the difference between a Data URI and Base64?

The Data URI includes the file type in front (data:image/png;base64,…) and can be used directly in a src or url(). "Base64 only" is the code without that prefix.

Is my image uploaded to any server?

No. The conversion happens in your browser.

Related tools

Not what you were looking for?

We have more than 60 tools that work without uploading your files. Type what you need:

Missing? Ask us for the tool you need