Format Code Now
/

Base64 to Image Converter

ED-72

Paste a Base64 string or a data URI and get the image back. The tool reads the real file type from the decoded bytes, shows a preview and lets you download the file.

Runs in your browser. Nothing is uploaded.

Base64 or data URI

Image

The decoded image appears here.

How to use it

  1. Paste the Base64 text or the whole data URI into the left box. You can paste a CSS url() rule or an img tag that contains one.
  2. Read the status line for the type and size, and check the preview.
  3. Press Download image to save the file with the right extension.
  4. If you get an error, the message says what the decoded data really is.

What it accepts

A data URI such as data:image/png;base64,iVBOR..., or only the Base64 part. The standard and URL-safe alphabets both work, trailing = signs may be missing, and line breaks and spaces are ignored. A data URI wrapped in CSS url() or an img src is found inside the text. Data URIs that are not Base64, such as SVG written with percent signs, are decoded as well.

How the type is found

The tool decodes the text and looks at the first bytes of the result. It recognizes PNG, JPEG, GIF, WebP, BMP, ICO, AVIF, SVG, TIFF and HEIC. If the data URI claims a different type from the real one, the result says so and the download gets the real extension. The picture is not re-encoded, so the download is identical to the file that was encoded.

When it refuses

If the decoded bytes are a PDF, a ZIP, audio, plain text or something unknown, the tool does not pretend it is a picture. The error names what the data looks like, or shows its first bytes. Most browsers cannot draw TIFF or HEIC, so for those the preview stays empty, but the file can still be downloaded.

Error messages and what to do

MessageWhat it meansFix
Not valid Base64: character … at position … is not allowedThe text holds a character that is not part of Base64.Remove the extra characters or paste only the Base64 part.
Not valid Base64: the length is impossible (one stray character at the end). The text may be cut short.One character is left over, so the text was probably truncated.Copy the full string again.
The decoded data is not an image. Its first bytes match this type: …The Base64 is valid but holds another kind of file.Check where the Base64 came from.
This is markup, not Base64.The text starts with < and looks like HTML or SVG.Save SVG as a .svg file, or use the SVG to Base64 converter.

Questions people ask

How do I convert Base64 to an image?

Paste the Base64 string or data URI into the box. The image appears in the preview with its type and size, and Download image saves it. You do not need to remove the data:image/png;base64, prefix.

Do I need to remove the data URI prefix?

No. Both forms work: the full data URI and the bare Base64 text. If a prefix names a type that does not match the bytes, the tool uses the real type and tells you.

Why do I get an invalid Base64 error?

The text holds a character outside A to Z, a to z, 0 to 9, plus, slash, minus, underscore and equals, or it was cut short. The message gives the position of the first bad character, counted without spaces and line breaks.

Which image formats are detected?

PNG, JPEG, GIF, WebP, BMP, ICO, AVIF, SVG, TIFF and HEIC, based on the first bytes of the decoded data and not on the label. Anything else is refused with a message that says what it found.

Why is the preview empty but the file downloads?

Your browser may not support the format, which is common for TIFF and HEIC. The decoded bytes are still the original file, so the download works and opens in an image viewer that supports the format.

Can it decode an SVG data URI?

Yes, in Base64 form and in the percent-encoded form. The result downloads as an .svg file. If you paste raw SVG markup that is not a data URI, the tool tells you it is markup and not Base64.

About this tool

Decodes Base64 or a data URI back into the original bytes and works out the image type from the first bytes, not from the label in the data URI. If the label disagrees, the result says so and the file gets the extension of the real type. It accepts the standard and URL-safe alphabets, missing padding, line breaks, and a data URI wrapped in url(), src or similar text. Data URIs without Base64, such as percent-encoded SVG, are decoded too. Anything that is not an image is refused with the type it looks like. The image is not re-encoded, so the download is byte for byte what was inside the Base64. TIFF and HEIC are recognized, but most browsers cannot show them in the preview.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.