Skip to content
ImageRuns in your browser

Base64 to Image Converter

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

Upload
Single file · 10 MB max
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Your file is read, transformed and re-encoded inside this browser tab using JavaScript. There is no upload endpoint — nothing leaves your machine, nothing is stored, and the result is created as a local object URL that disappears when you close the page.

Overview

About the Base64 to Image Converter

Paste Base64 image data and preview it instantly, then download as PNG, JPG or WebP. Detects the MIME type automatically and explains decode errors.

This is the reverse of the Image to Base64 tool, and it turns up in more situations than you would expect: debugging an API response, checking whether an image survived a database round trip, recovering an asset from an HTML email, or verifying that a build step inlined the right file.

What the decoder accepts

Real-world Base64 rarely arrives clean. The parser handles:

  • a complete data URI with any MIME type;
  • a CSS url("data:image/png;base64,…") wrapper, quoted or unquoted;
  • bare Base64 with no prefix at all;
  • strings broken across lines, which happens constantly when copying from terminals, logs and email;
  • missing trailing = padding, which some encoders omit.

Whitespace is stripped and padding is restored before decoding, so a payload that would fail a strict atob() call still works here.

Reading the failure messages

Invalid character means something outside the Base64 alphabet is present. If you see % characters the string is still URL-encoded — run it through the URL decoder first. If you see - or _ it is base64url, which this tool translates automatically.

Truncated data means the payload decoded but the image structure is incomplete — typically a copy that stopped early. Compare the character count against what the source claims.

Unrecognised format means the bytes decoded cleanly but do not begin with a known image signature. The data may be a document, an archive or simply not Base64 image data.

Why magic-byte detection matters

A data URI's declared MIME type is written by whoever created it, and it is frequently wrong — especially after a file has been renamed or passed through a system that guesses types from extensions. Reading the first few decoded bytes tells you what the image actually is, which is why the detected format is shown separately from the declared one and used to pick the default download extension.

Step by step

How to use the Base64 to Image Converter

  1. Paste the Base64 string — with or without the data:image/...;base64, prefix.

  2. Press Decode; the preview appears as soon as the bytes are valid.

  3. Read the detected format, dimensions and decoded file size.

  4. Download in the detected format, or re-encode to PNG, JPG or WebP.

  5. If decoding fails, check the error hint — usually a stray line break or truncation.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Prefix-optional parsing

Accepts bare Base64, complete data URIs, CSS url() wrappers and strings with embedded line breaks — it normalises all of them before decoding.

Instant visual verification

Seeing the decoded image is the only reliable way to confirm a string was transferred intact. Dimensions and byte count are shown alongside.

Explains failures

Invalid characters, wrong padding and truncated payloads each produce a specific message rather than a blank preview.

Re-encode on the way out

Decode a WebP data URI and save it as a PNG, or normalise an unknown format into something your CMS will accept.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

Do I need to include the data:image/png;base64, prefix?

No. The tool strips a data URI prefix if present and also handles bare Base64. If the prefix is there it is used to guess the output extension; without it, the format is detected from the decoded bytes.

Why does my string fail to decode?

The usual causes are truncation (the string was cut off during copy), stray whitespace or line breaks introduced by an email client, missing padding characters at the end, or a string that was URL-encoded and still contains %2B or %2F sequences.

How is the image format detected?

From the magic bytes at the start of the decoded data — PNG begins with 89 50 4E 47, JPEG with FF D8 FF, GIF with GIF8, WebP with RIFF….WEBP. This is more reliable than the MIME prefix, which is sometimes wrong.

Can the decoded image be a different format on download?

Yes. Once decoded, the image is just pixels on a canvas, so it can be exported as PNG, JPG or WebP regardless of the original format.

Is it safe to decode Base64 from an unknown source?

Decoding renders the image in a sandboxed <img> element; it does not execute code. Still, treat unexpected Base64 payloads with suspicion — inline data URIs are a known vector in phishing emails because they hide the real destination.