What does a Base64 to image decoder do?
A Base64 to image decoder reverses the encoding that turned a picture into text. It reads the string, checks that every character belongs to the Base64 alphabet, converts the characters back into bytes, and hands those bytes to the browser as an image — which is what makes the picture appear on the page rather than in a downloaded file.
The string usually arrives in one of two forms. A complete data URI carries its own metadata: data:, then the MIME type, then a ;base64 marker, then a comma, then the encoded payload. A bare payload is just the encoded characters with no prefix, which is what an API response field or a database column often holds. Both are accepted here, and when the MIME type is missing it is worked out from the bytes themselves.
The useful part is what happens when the string is wrong. Rather than failing silently or producing a corrupted file, the decoder names the character it could not accept, reports a truncated string, or explains that the data: prefix is missing its comma. It also shows the first bytes of the result, which is how the format is identified and how you can see at a glance whether the decode produced a real PNG rather than something that merely claims to be one.
How to decode Base64 into an image
- Paste a complete data URI or a bare Base64 string into the box — line breaks and spaces are ignored.
- Read the reported MIME type and decoded size, which appear as soon as the string is valid.
- Check the preview. If the bytes are not an image, the tool says so instead of showing a broken picture.
- Glance at the first bytes if you want to confirm the format by hand — a PNG always begins 89 50 4e 47.
- Choose a save format: keep the original bytes, or re-encode through a canvas as PNG, JPG or WebP.
- Download the file, or copy the MIME type for pasting into a header or a configuration file.
Base64 to Image limits and rules
| Item | Limit |
|---|---|
| Accepted input | A full data URI, a bare Base64 payload, or the URL-safe variant with - and _ |
| Whitespace | Spaces, tabs and line breaks are stripped before decoding |
| Data URI without ;base64 | Treated as percent-encoded text, which is how SVG is often carried |
| Format detection | From the MIME type when present, otherwise from the leading bytes |
| Recognised headers | PNG, JPEG, GIF, BMP, WebP, SVG and anything else the browser can render |
| Save formats | Original bytes, or PNG, JPG and WebP through a canvas re-encode |
| Not covered | Encrypted payloads, and strings that were truncated in transit |
When to use it
- Checking what an API response field actually contains before writing code against it.
- Recovering a picture from a data URI pasted out of a log, a config file or an email.
- Confirming that a string copied from a database column is an image rather than a document.
- Turning an inlined SVG into a saved file that can be opened in an editor.
- Diagnosing a broken image on a page by decoding the src value it was given.
Is it private?
Decoding happens with JavaScript in this page. The string is never sent anywhere, and the preview is an object URL created locally from the decoded bytes — nothing is uploaded, stored or logged.
Frequently asked questions
Almost always a character that does not belong to the alphabet, or a string that was cut short. A copy from a rendered web page can pick up a stray character or a wrapping line break in the middle of the payload, and some tools truncate a long value when they display it. This decoder names the offending character rather than skipping it, because silently ignoring it would give you a corrupted image instead of an error message.
It is the same encoding with two characters swapped: + becomes - and / becomes _, so that the string can travel through a URL, a filename or a query parameter without being escaped or misread. The two forms are otherwise identical, and this tool normalises the URL-safe one before decoding, so you can paste either. What it will not do is guess at padding, since an incomplete payload produces the wrong bytes.
In two stages. If the string is a data URI, the MIME type after data: is the first answer. If it is a bare payload, or the declared type is a generic application/octet-stream, the leading bytes decide: a PNG begins 89 50 4e 47, a JPEG ff d8 ff, a GIF 47 49 46, a BMP 42 4d and a WebP has RIFF in the first four bytes. That is why the first sixteen bytes are shown — they are the evidence behind the answer.
Only if you ask it to. Keeping the original format writes the decoded bytes exactly as they were, which is the one option that cannot change the picture. Choosing PNG, JPG or WebP draws the image onto a canvas and encodes it again, which is useful when you need a different format or a smaller file, but any re-encode is a fresh generation: a JPG loses a little quality and a format without transparency will flatten it.
Yes. The bytes are decoded and offered for download whatever they are, and the page says plainly that the result is not an image when the MIME type is text/plain, application/pdf or something else. A data URI with no ;base64 marker is handled differently again — it carries percent-encoded text rather than Base64, which is legal and common for SVG, and the decoder reads it as text instead of rejecting it.
Roughly, yes — every four characters stand for three bytes, so the decoded size is about three quarters of the payload length, and that is reported for you. The relationship is not exact because of padding and the prefix, and because a highly compressible image can be large in pixels yet small in bytes. For the actual dimensions, the tool reads them from the decoded image itself and shows the width and height in pixels.
Related tools
Written and maintained by Md. Nur Hossain Repon.