Image to Base64 Converter

Convert images to Base64 data URIs for HTML and CSS, or decode Base64 back to an image.

How to use the Image to Base64 Converter

  1. For encoding, drop an image onto the page or paste it with Ctrl+V.
  2. Copy the data URI, raw Base64, HTML tag or CSS rule you need.
  3. For decoding, choose Base64 → Image and paste the string.
  4. Check the preview and click Download image.

About this tool

Convert image to Base64 text so you can embed a picture directly in HTML, CSS, JSON, email templates or code without a separate file. Drop in a PNG, JPG, WebP, GIF, SVG or icon and get four ready-to-copy versions: the full data URI, the raw Base64 string, an HTML tag and a CSS background-image rule.

It works the other way too: switch to Base64 → Image, paste a Base64 string or data URI, and the tool decodes it, shows a preview with the dimensions and format, and lets you download the image file. It even recognizes the image type when the data: prefix is missing.

Base64 makes data about a third larger than the original file, so it is best for small icons and logos. The image to Base64 conversion happens in your browser – nothing is uploaded.

Frequently asked questions

It is an image file written as plain text using 64 safe characters. Wrapped in a data URI (data:image/png;base64,…) it can be used anywhere a URL is expected, such as an <img> tag or CSS.

For very small images like icons, in emails, single-file HTML pages or JSON APIs. For larger images a normal file is faster, because Base64 is about 33% bigger and cannot be cached separately.

Choose Base64 → Image, paste the text (with or without the data: prefix) and click Download image.

Check that it was copied completely and contains only A–Z, a–z, 0–9, + and / (or - and _ for URL-safe Base64), with optional = padding at the end.

No. Encoding and decoding both happen in your browser.