Skip to content
ImageRuns in your browser

Base64 to Image Converter

A Base64 to image converter that decodes a string or data URI back into a picture you can view and save.

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 or a data URI, preview the picture instantly and download it with the right extension — the format is read from the decoded bytes.

This is the reverse of the Image to Base64 tool, and a Base64 to image conversion 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. In every one of them the fastest route to an answer is a Base64 to image decode that happens on the spot — the string is parsed, decoded and rendered in the browser, with nothing installed, nothing uploaded and nothing to sign up for.

What the Base64 to image decoder accepts

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

  • a complete data URI with any MIME type, and any extra parameters after it;
  • bare Base64 with no prefix at all;
  • base64url, the URL-safe variant that writes - and _ where standard Base64 writes + and /;
  • strings broken across lines, which happens constantly when copying from terminals, logs and email;
  • payloads whose trailing = padding the encoder left off.

Whitespace is removed and the URL-safe alphabet is translated back before anything is decoded, so a string that a strict atob() call would reject still works here. Two things are not accepted, and both are quick to fix by hand: a CSS url("…") wrapper, where you should paste only what is inside the quotes, and a percent-encoded string, which needs the URL decoder first. Whatever shape the string arrived in, the Base64 to image conversion starts from the same place: clean characters in, decoded bytes out.

Reading the Base64 to image failure messages

There are three distinct outcomes, and each one points somewhere different.

Stray characters or a truncated paste is the parser refusing the string before any decoding is attempted. Something outside the Base64 alphabet is present — usually % sequences from a URL-encoded copy, or a fragment of the surrounding JSON, CSS or log line that came along with the payload.

Decoded to zero bytes means the string was legal Base64 but empty in substance. A stray = or two on their own will produce it.

Could not be decoded as an image is the informative one. The Base64 was valid and real bytes came out, but nothing recognised those bytes as a picture. Either the copy stopped early and the file is incomplete, or the payload was never an image to begin with. Check the character count against the source before assuming corruption: a truncated data URI is far more common than a corrupt one, and a payload that turns out to be a PDF or a zip is more common still.

Why magic-byte detection matters in a Base64 to image conversion

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 decoded bytes tells you what the image actually is: PNG opens with 89 50 4E 47, JPEG with FF D8 FF, GIF with GIF8, WebP with RIFF and then WEBP four bytes later, and SVG simply contains an <svg tag, because it is text rather than binary. The Format row therefore reports what the signature says rather than what the prefix claimed, and that is what picks the extension you download. Bytes do not lie about themselves, which makes signature detection the most trustworthy stage of any Base64 to image converter.

What the Base64 to image preview proves

Rendering the image is not decoration, it is the test. The decoded blob is loaded into an <img> element before the result panel appears, so a payload that produces bytes but not a viewable picture is reported as a failure instead of handed to you as a broken download. That is the difference between this and a atob() call in a console: the console confirms the string was legal, the preview confirms the image survived — which is the entire point of a Base64 to image check.

Because it genuinely renders, the dimensions and the decoded size are measurements rather than claims. If a database round trip, an email client or a copy-paste truncated the payload, those numbers will not match the source — and you find out here, in one step, rather than three steps later when something else refuses the file.

When to use a Base64 to image converter

The situations that bring people to this page are remarkably consistent: an API response with an image field and no way to look at it, a <img src="data:…"> pulled out of an HTML email, a column in a database dump, a build step that inlined an asset and you want to know which one, a QR or signature payload from a payment or KYC flow. In all of them the question is the same — is this the picture I think it is? — and a Base64 to image conversion answers it in one paste.

There is a second, quieter use case: asset archaeology. Data URIs embedded in old templates, cached pages or exported documents are sometimes the only surviving copy of a logo or an icon, and decoding them here — with the real extension attached — is how you dig the file back out. It is the same Base64 to image conversion either way: paste the string, read the preview, download the file.

A private Base64 to image workflow

Everything in this Base64 to image converter runs locally. The string you paste never leaves the tab: it is parsed, decoded and rendered by the browser's own APIs, and the download is a local file that never touches a server. That matters because the payloads that need this check are rarely public — they are customer photographs, KYC documents, internal screenshots and payment signatures, and a Base64 to image tool that uploaded them somewhere to decode them would defeat its own purpose. So this one does not: no account, no queue, no upload. Paste the string, read the preview, download the file, done.

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. Rename the file if you want to, then download it in the format the bytes turned out to be.

  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 a bare payload, a full data URI with any MIME type and any parameters after it, base64url with dashes and underscores, and strings broken across hundreds of lines.

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.

The extension follows the bytes

The decoded signature picks the extension, so a payload that arrived with no prefix at all still saves as .jpg, .png, .gif, .webp or .svg — and you can set the file name before downloading.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

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

No. A data URI prefix is stripped when it is there and a bare payload works just as well. Either way the decoded bytes are read afterwards and they are what decide the extension, so a mislabelled prefix cannot trick you into saving a JPEG as .png.

Why does my string fail to decode?

Truncation is the usual one: the copy stopped early, so the bytes decode but the image structure is incomplete. Line breaks, stray whitespace and the base64url alphabet are all handled for you, so those are not the cause. A string that is still percent-encoded and shows %2B or %2F sequences will fail — run it through the URL decoder first and paste the result.

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?

Not here — you get back the exact bytes that were encoded, which is the whole point when you are verifying a payload. If you need a different format afterwards, put the downloaded file through one of the converters, such as WebP to PNG or PNG to JPG.

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.