Image to Base64 converter and back

Convert an image to Base64 or a data URI for CSS, HTML and Markdown, or decode a Base64 string back into an image you can preview and download.

🔒 Runs in your browser
Drag an image here or click to choose PNG, JPG, GIF, WebP, SVG, ICO, AVIF · or paste with Ctrl+V

About this tool

This free converter turns PNG, JPG, GIF, WebP, SVG, ICO or AVIF images into Base64 or a data URI ready for CSS, HTML or Markdown, and decodes Base64 strings back into images. It is aimed at web developers and designers, needs no sign-up, and works in your browser, so images are not uploaded.

How to use

  1. Choose the Image to Base64 tab and drop an image, click to select one or paste it with Ctrl+V.
  2. Pick the output: data URI, plain Base64, CSS background-image, HTML img tag or Markdown.
  3. Copy the result or download it as a .txt file.
  4. To decode, open the Base64 to image tab and paste a Base64 string or data URI.
  5. Check the preview and download the restored image.

Frequently asked questions

Are my images uploaded to a server?

No. Encoding and decoding happen locally in your browser, and nothing is sent to a server.

Which formats are supported?

You can encode PNG, JPG, GIF, WebP, SVG, ICO and AVIF. When decoding, PNG, JPG, GIF, WebP, SVG, BMP, ICO and AVIF are recognized even if the string has no data: prefix.

Should I embed large images as Base64?

Usually not. Base64 text is about a third larger than the original file and cannot be cached separately, so it is best for small images of roughly 10 to 20 KB.

What is a data URI?

A data URI embeds the file itself in a link that starts with data:image/...;base64, so you can use an image in CSS or HTML without a separate file.