Base64 to Image
Paste a Base64 string and get the file back. The type is read from the data itself rather than from the label, so a PNG announced as a JPEG still downloads correctly. Decoded in your browser — nothing is sent anywhere.
How do I convert a Base64 string to an image?
What a Base64 image string actually is
Base64 encodes binary data using 64 printable characters, so that a file can travel through a channel that only accepts text. An image embedded in an HTML page, a CSS file, an email or a JSON API response is almost always Base64 — the bytes of the PNG or JPEG rewritten as letters, digits, plus and slash. Converting Base64 to an image means reversing that: turning the characters back into the original bytes and handing them to you as a file.
Most of these strings arrive with a data URI prefix — data:image/png;base64, — which tells a browser what to do with what follows. Both forms work here. Paste the whole thing including the prefix, or paste just the encoded portion; the prefix is stripped if present and ignored if not.
The type is detected, not trusted
The image/png part of a data URI is a label supplied by whoever produced the string, and it is wrong often enough to matter. A file labelled JPEG that is really a PNG downloads with the wrong extension and then will not open, which is a confusing failure to debug. This page reads the first few bytes of the decoded data instead — the signatures that identify PNG, JPEG, GIF, BMP, WebP and PDF — and names the file accordingly. If the two disagree, the bytes win, because the bytes are the file.
When the decode fails
Two things go wrong regularly. The first is a truncated paste: Base64 has no error detection, so a string cut short by a text field or a line-wrapping email simply will not decode. The second is the URL-safe variant, which uses - and _ in place of + and / and usually drops the = padding — common in JWTs and API tokens. Both variants are accepted here and the padding is restored automatically, so a URL-safe string works without you having to convert it first.
If it decodes to text rather than a file
Not every Base64 string is a file. If yours decodes to readable characters — JSON, a token payload, a configuration blob — the Base64 decoder is the page for that, with plain text, hex and JSON output. To go the other way and produce a Base64 string, use the Base64 encoder. All three run in your browser, which is the point when the value is a credential.
Next steps
Related tools
- decode it to text instead — when the string decodes to characters rather than a file.
- go the other way — to produce a Base64 string from a value.
What to do with the result
- convert the decoded image — if you need a different format.
- strip its metadata — a decoded image keeps whatever EXIF was encoded with it.
Browse all developer utilities, or see every QuickMerge tool.
Frequently asked questions
Paste the string above. It decodes as you type, shows a preview, and the download button names the file with the correct extension. The data URI prefix is optional — paste it or leave it out.
It reads the first few bytes of the decoded data, which identify PNG, JPEG, GIF, BMP, WebP and PDF unambiguously. The image/png label in a data URI is supplied by whoever made the string and is wrong often enough that trusting it produces files that will not open.
Usually it is truncated — Base64 has no error detection, so a string cut short by a text field or a wrapping email fails silently. The other common cause is missing padding on a URL-safe string, which is restored automatically here.
Yes. The URL-safe variant uses - and _ in place of + and / and usually drops the = padding. Both are accepted and the padding is restored, so a token segment decodes without converting it first.
Yes — a PDF is detected from its %PDF signature and downloads as a .pdf. There is no inline preview for it, but the file itself is intact.
Then it encodes text rather than a file. Use the Base64 decoder, which outputs plain text, hex or formatted JSON.
No. Decoding is done by JavaScript in this tab and the file is created in browser memory. That matters because Base64 blobs routinely carry embedded credentials, signed payloads and private images.