Skip to content

Image to Base64 Converter (and Base64 to Image)

Convert an image to a Base64 data URI, an img tag or a CSS background, or decode a Base64 string back to an image and download it. Works offline in your browser.

Drop an image here, paste from the clipboard, or

JPG, PNG, WebP, GIF, BMP or SVG. Files never leave your browser.

This is not a valid Base64 image.

How to convert an image to Base64

  1. Drop or choose an image.
  2. Pick the output: a data URI, the raw Base64 string, a ready <img> tag with width and height, or a CSS background rule.
  3. Copy the result into your HTML, CSS, JSON or email template.

To go the other way, open the Base64 to image tab and paste a string. The tool detects PNG, JPG, GIF, WebP, SVG and BMP from the data itself, shows a preview and lets you download the file.

When to inline images as Base64

  • Good for: very small icons, placeholders and images in HTML emails or single-file demos, where one fewer request matters.
  • Not good for: photos and large images. Base64 is about 33% larger than the file, cannot be cached separately and delays the HTML or CSS that contains it.
  • For SVG icons, a URL-encoded SVG data URI is often smaller than Base64.

Shrink an image before inlining it with the image compressor.

All processing happens in your browser. Your images are never uploaded to a server, so the tool works with private photos and keeps working offline once the page has loaded.

More image tools