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?

Decoded file preview

What a Base64 image string actually is

A Base64 data URL can carry image bytes as text in HTML, CSS or an API response. Decoding reconstructs those bytes; it does not improve image quality or establish that the bytes are a supported, undamaged image.

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

What to do with the result

Browse all developer utilities, or see every QuickMerge tool.

Frequently asked questions