How to convert Base64 back to an image
- Paste your Base64 string or complete data URI into the box above.
- Press Decode string. Leading and trailing whitespace and line breaks are handled for you.
- Check the detected format and pixel dimensions shown beneath the field.
- Look at the preview to confirm it is the image you expected.
- Press Download image to save it with the correct file extension.
What this decoder handles
- Accepts a full data URI, or a bare Base64 payload with no prefix at all.
- Detects PNG, JPG, GIF, WEBP and SVG from the decoded bytes rather than trusting the prefix.
- Strips whitespace, newlines and stray quotes that survive copying out of source code.
- Shows the pixel dimensions so you can confirm you have the right asset.
- Names the downloaded file with the correct extension automatically.
- Explains clearly what is wrong when a string will not decode.
Where these strings come from
Base64 exists because plenty of systems were built to carry text and nothing else. Encoding binary data as letters, digits and a couple of symbols lets an image travel through a stylesheet, a JSON payload, an email body or a database field that would otherwise mangle it.
So you meet these strings when you are working with somebody else's code: a data URI buried in a CSS background rule, an avatar embedded in an API response, an inline logo in an HTML email template, or an image column in an exported database table. Decoding it back to a file is how you find out what you are actually looking at.
Typical reasons to decode
- Extracting an icon or logo that a previous developer inlined into a stylesheet.
- Inspecting an image returned by an API before wiring it into an interface.
- Recovering an attachment from an email source view or a raw message file.
- Pulling images out of an exported JSON or database dump for reuse elsewhere.
- Checking that an upload encoded correctly during debugging.
What the tool accepts
A complete data URI looks like data:image/png;base64,iVBORw0KGgo… and carries its own MIME type. That is the easiest case. A bare payload with no prefix works too: this decoder reads the first few decoded bytes and identifies the format from the file signature, which is more reliable than trusting a prefix that may have been written by hand.
Strings copied out of source code often arrive with baggage, line breaks from wrapping, leading spaces from indentation, surrounding quotes, or a trailing comma. All of that is stripped before decoding, so you rarely need to clean the input yourself.
When decoding fails
Three problems account for almost every failure. The string may be truncated, which happens constantly when copying from a terminal or a log that clipped the line. The length is a giveaway, since a real image rarely encodes to only a few hundred characters. It may be URL-safe Base64, a variant that swaps two characters for hyphen and underscore, which needs converting back first; the Base64 decoder is the better tool for inspecting that. Or it may not be an image at all, but a PDF, a font or a compressed archive that happens to be Base64 encoded.
The status line names which of these applies rather than simply reporting that something went wrong, so you can act on it.
Size, format and privacy
Remember that the decoded file is about a quarter smaller than the string, since Base64 inflates data by roughly a third on the way in. A 400 KB string yields an image of around 300 KB. If the result turns out to be larger than you want, the image compressor will trim it.
Decoding happens entirely in your browser. The string is converted to a binary blob in local memory and turned into a download link there, so nothing is transmitted. That matters when the string came from a production API response or a client's codebase. To go the other way, the image to Base64 encoder is the matching tool.