← Tools
Encoding

Base64 to Image

Paste a Base64 data URI and instantly preview the image. Download or copy the result — all in your browser.

Base64 Input0 chars
Image Preview
Image preview will appear here

What is Base64 image decoding?

A data URL embeds binary as ASCII: data:image/png;base64, plus the encoded bytes. The browser already knows how to paint that string as an image. This page requires that prefix so the MIME type is explicit; it does not guess PNG versus JPEG from the first bytes. See the MDN Data URLs.

The input must match /^data:image\/[a-zA-Z+]+;base64,/. Anything else — raw Base64, a missing comma, image/svg+xml with the plus sign is allowed because + is in the class, but data:image/png;base64 with no comma fails. On a matching prefix the string is assigned to Image.src. onload records TYPE (the token after image/), an approximate size from length × 3/4, and width × height. onerror sets Invalid image data. There is no magic-byte sniffing and no auto-prefix. Copy URI copies the same data URI you pasted. Download saves image.{ext} where ext is the TYPE token (jpeg, png, gif, webp, svg+xml). Size is an estimate from character length, not the decoded byte length after padding. Nothing is uploaded. To encode a file the other way, use Image to Base64.

When to use this tool

  • Preview an embedded asset — Copy a data URI out of HTML, CSS, or a JSON field and confirm it is the icon you think it is.
  • Download the file — Download writes image.png / image.jpeg / … from the MIME subtype so you can drop it into a design tool.
  • Reject raw Base64 — If you only have iVBORw0KGgo… prepend data:image/png;base64, (or jpeg, gif, webp, svg+xml) yourself.
  • Encode the other direction — Image to Base64 uses FileReader.readAsDataURL and produces the prefix this page requires. Image to Base64

How to use the Base64 to Image

Step 1

Paste a data URI

The left pane is labeled Base64 Input. The placeholder shows data:image/png;base64,iVBORw0KGgo… The string must start with data:image/TYPE;base64, including the comma.

Step 2

Read the preview and sidebar

A valid image fills Image Preview. Type, Size, and Dimensions appear in the sidebar and under the preview.

Step 3

Copy URI or Download

Copy URI copies the data URI. Download uses the MIME subtype as the file extension. Clear resets input, preview, and error.

Worked examples

1×1 PNG data URI

Input
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
Output
Preview of a 1×1 PNG. Type PNG. Dimensions 1 × 1 px. Download saves image.png.

Missing prefix is rejected

Input
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
Output
String must start with data:image/TYPE;base64,…

The page does not auto-detect PNG from the iVBORw0K header.

Tips

  • TYPE must be letters or plus signs — image/svg+xml works; image/svg.xml does not.
  • Strip wrapping quotes from JSON before paste.
  • Size in the sidebar is estimated from string length, not a decoded byte count.

Frequently Asked Questions

Why does it say “invalid image data”?

The Base64 payload may be corrupt or truncated. If the prefix itself is wrong, you will see “String must start with data:image/TYPE;base64,…” instead.

Can I paste just the Base64 without the prefix?

No. The tool needs the MIME type from the prefix. Prepend data:image/png;base64, (or jpeg, gif, webp, svg+xml) including the comma.

Does the download preserve the original format?

The file extension is the TYPE token from the URI, so image/jpeg downloads as image.jpeg. The bytes are the decoded payload, not a re-encoded PNG.

Is large data handled?

The browser decodes natively. Very large images may take a moment. There is no extra size cap on this page (Image to Base64 caps uploads at 5 MB).

Does decoding upload the URI?

No. Image.src is set locally.