Image to Base64

Convert an image to Base64 and get a data URI, plain Base64, an HTML img tag, a CSS background and JSON, ready to copy. Works with PNG, JPG, SVG, WebP, GIF and ICO; nothing is uploaded.

Free · Runs in your browser · Updated 17 October 2026

Image to Base64 converter

How to

Convert an image to Base64.

  1. 1Choose the image, or drop it on the box.
  2. 2Copy the format you need: data URI, Base64 only, HTML, CSS or JSON.
  3. 3Paste it into your code. The sizes show how much bigger the text is than the file.

When to use it

Inline small images only.

  • Base64 turns every 3 bytes into 4 characters, so the text is about 33% larger than the file.
  • Good for small icons and placeholders in HTML email, single-file pages, CSS and JSON APIs.
  • Bad for photos and anything over about 10 to 20 KB: the page gets heavier and the browser cannot cache the image separately.
  • For SVG, plain text in a data URI is often smaller than Base64. For favicons, use a real file: see PNG to ICO.

FAQ

Questions people ask first.

How do I convert an image to Base64?
Open the image in the tool above. The data URI and the plain Base64 string appear straight away with copy buttons.
What is a data URI?
A way to put a file inside a web address: data:image/png;base64, followed by the Base64 text. Browsers show it like a normal image link.
How do I use Base64 in an img tag?
Copy the HTML output: <img src="data:image/png;base64,…" alt="…">. Add a meaningful alt text.
Why is Base64 bigger than the image?
It uses only 64 safe text characters, 6 bits each, so 3 bytes become 4 characters: about 33% more.
Is my image uploaded?
No. The file is read by your browser; nothing is sent anywhere.

From the team behind the tools

Need image handling inside your own app?

Daniotech builds web and mobile products, including upload flows that resize, convert and check images on the device before they reach your server.