Base64 to image converter

Paste Base64 text or a data URL and get the image back.

Runs in your browser. Nothing you type is sent anywhere.

How to convert Base64 to an image

  1. Paste a data:image/... URL or raw Base64 text.
  2. Click Decode image.
  3. Preview it, then download the file.

Where Base64 image text comes from

  • A data URL copied out of a webpage's CSS or HTML source.
  • A field in an API response or database export, often storing a photo as text instead of a file.
  • A screenshot or logo embedded in an email's HTML.
  • An image to Base64 tool, including the one on this site.

How the file type gets detected

When the text starts with a data:image/... prefix, the type is read straight from it. Pasted text without a prefix is decoded first, then the first bytes of the result are checked against each format's own signature.

FormatDetected by
PNGBytes 89 50 4E at the start
JPGBytes FF D8 FF at the start
GIFBytes 47 49 46
BMPBytes 42 4D
WEBPA RIFF header with a WEBP tag
ICOBytes 00 00 01 00
SVGText starting with svg or xml

Fixing a decode error

  • Line breaks and spaces are removed automatically, so text copied from a code editor still works.
  • A truncated string, where part of the text was cut off while copying, cannot be decoded and shows an error.
  • Extra characters outside the Base64 alphabet, or a missing trailing = sign, also cause an error.

Base64 to Image FAQ

Where do I get the Base64 text?

It usually comes from a data URL in HTML or CSS, an API response, a database field, or an image to Base64 tool.

Does it work without the data:image/... prefix?

Yes. Paste just the raw Base64 characters and the tool detects the image type from the decoded bytes.

Which image types get detected?

PNG, JPG, GIF, WEBP, BMP and ICO are detected by reading the file's own header, and SVG is detected when the decoded text starts with an svg or xml tag.

Is my data uploaded?

No. Decoding happens entirely in your browser, so nothing is sent anywhere.

Why do I get "not valid Base64 image data"?

The pasted text is missing characters, was cut off while copying, or contains something outside the Base64 alphabet (A to Z, a to z, 0 to 9, plus, slash and = padding). Copy the full string again.

Do I need to remove line breaks before pasting?

No. Line breaks and spaces are stripped automatically before decoding, so text copied from formatted code still works.

Can I decode an SVG from Base64?

Yes. If the decoded text starts with an svg or xml tag, it is treated as an SVG and previewed like any other image.

Is there a size limit on the Base64 text I can paste?

No hard limit. Very long strings just take a moment longer for the browser to decode.

Related tools