Skip to content
DoItJag

Base64 to Image

Found a long data:image/png;base64 string in HTML, CSS, JSON or an API response? Paste it here to see the picture and save it as a normal image file. The format is worked out from the decoded data itself.

Spaces, line breaks and URL-safe Base64 are fine.

About the Base64 to Image Converter

Developers meet Base64 images all the time: inside API responses, database exports, HTML emails, stylesheets and browser developer tools. A string such as data:image/jpeg;base64,/9j/4AAQ... is a whole picture written as text, but you cannot see it until it is decoded. Paste it here and the picture appears, ready to save as an ordinary image file.

What you can paste

The decoder is forgiving about input:

  • A complete data URI, with or without the MIME type.
  • Bare Base64 with no prefix at all.
  • A whole CSS rule or HTML image tag; the page finds the data inside the quotes or brackets.
  • Text broken over several lines, padded or unpadded, standard or URL-safe (using minus and underscore).
  • Percent-encoded SVG data URIs, common in CSS icon sets.

For very long strings you can open a text file containing the data instead of pasting.

How the format is decided

Labels in data URIs are frequently wrong, for instance a PNG marked as JPEG after a copy-and-paste edit. The page ignores the label for the download and examines the first bytes of the decoded data, the so-called magic number that every image format starts with. It recognises PNG, JPG, GIF, WebP, AVIF, SVG, BMP, ICO, TIFF and HEIC, warns when the label disagrees, and saves the file with the correct extension.

When something goes wrong

A clear message explains the problem: characters that are not Base64, a string cut off part-way, or data that decodes but is not a picture at all, such as a PDF or plain text. If the browser cannot display a valid file, for example TIFF in most browsers, you can still download it and open it elsewhere.

Safety

Decoding happens entirely in your browser. SVG files can contain scripts, but the preview draws them as a picture, where scripts never run. The downloaded file is your exact original data.

How to use Base64 to Image

  1. Paste the Base64 text or data URI (or open a .txt file that contains it).
  2. Check the picture, its format, size and dimensions.
  3. Choose a file name and download the image.

Privacy: how it works

Everything happens in your browser. Your text is not sent to any server.

Frequently asked questions

Do I need the data:image/... part?

No. Plain Base64 works too, as does a whole CSS url("...") or an HTML img tag; the page finds the data inside. Line breaks, spaces and URL-safe Base64 are accepted.

Why is the format different from what the text says?

The label in a data URI is sometimes wrong. The page reads the first bytes of the decoded data to find the real format and saves the file with the matching extension.

Is it safe to paste a Base64 SVG?

The preview shows SVGs as a picture, where scripts inside them cannot run. The download is the original file, so open untrusted SVGs with care.