Base64 to Image

Decode a Base64 string or data URI back into a downloadable image.

Runs in your browser Instant No sign-up
Base64 or data URI
Image
Reverse

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use it

  1. Paste a data URI or a plain Base64 string. Whitespace and line breaks are ignored.
  2. The image appears on a checkerboard, so transparent areas are easy to see.
  3. Click Download to save it with the right extension, or Copy for PNGs to put the image itself on your clipboard.

The sample is a 16×16 PNG. It decodes to image/png · 109 bytes.

Wrong or missing types

Data URIs copied from logs, HTML or API responses often carry the wrong type, or none at all. The tool ignores the label and reads the signature instead. Pasting a PNG labelled as JPEG gives:

The data URI says image/jpeg, but the bytes are image/png. Using image/png.

Supported formats are PNG, JPEG, GIF, WebP, AVIF, BMP, ICO and SVG. Text that only looks like Base64 is rejected with a clear message, for example:

Decoded 12 bytes, but they don’t start with a known image signature (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO or SVG).

Checking an unknown string

Base64 that turns out to be an image often comes from places that don’t say so: a field in a database dump, a value in a log line, an attachment in a webhook payload. Decoding it here is safe because the bytes are only ever shown as an image. If the result looks wrong, check the status line: the detected type and the byte count tell you whether the string was truncated (an image cut off at the bottom) or is a different file altogether. A size of a few hundred bytes usually means an icon or a tracking pixel.

Common sources of Base64 images

  • HTML and CSS: src="data:image/…" and url("data:…") values.
  • JSON APIs: avatar or thumbnail fields, often without the data: prefix.
  • Email sources: inline images in multipart messages, wrapped at 76 characters per line.
  • Clipboard exports from design tools and screenshot apps.

To go the other way, use Image to Base64. To shrink the decoded image before reusing it, run it through the Image Compressor. For Base64 that holds text instead of an image, use Base64 Encode / Decode.

Doing it in code

// Browser: data URI → Blob you can download or display
const blob = await (await fetch(dataUri)).blob();
const url = URL.createObjectURL(blob);
# Shell: Base64 file → image
base64 --decode < image.b64 > image.png

Frequently asked questions

How does it know the image format?

From the first bytes of the decoded data, the file signature: PNG starts with 89 50 4E 47, JPEG with FF D8 FF, GIF with GIF89a, WebP with RIFF…WEBP, and so on. The type written in the data URI is only a hint; if it disagrees with the bytes, the tool uses the bytes and tells you.

Do I need the data: prefix?

No. Paste either a full data URI such as data:image/png;base64,iVBOR… or just the Base64 part. Line breaks, spaces and URL-safe Base64 (with - and _) are all accepted.

Is it safe to decode an SVG?

The SVG is displayed as an image, and browsers never run scripts inside images, so previewing is safe. SVG can contain scripts, though, so the tool warns you to review the file before you put it into a web page as inline markup.

Why does it say “Not an image”?

The Base64 decoded fine, but the bytes don't start with a known image signature. The data is probably text, a PDF or another file type, or the string was cut off. Decode it with the Base64 tool to see what it contains.

Is my data uploaded?

No. Decoding and the preview happen entirely in your browser.

Last updated