Base64 to Image Converter

Paste a Base64 string or a full data URI and this decoder turns it back into a real image file. You get a preview, the detected format and the pixel dimensions before you download anything.

Your files never leave this device

Decode a Base64 string Paste any data URI or raw Base64

A bare Base64 string works too. The format is detected from its opening bytes.

Detected file

Nothing decoded yet.

Preview

How to convert Base64 back to an image

  1. Paste your Base64 string or complete data URI into the box above.
  2. Press Decode string. Leading and trailing whitespace and line breaks are handled for you.
  3. Check the detected format and pixel dimensions shown beneath the field.
  4. Look at the preview to confirm it is the image you expected.
  5. 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.

Frequently asked questions

Do I need the data:image prefix?

No. A bare Base64 payload works, because the format is identified from the decoded file signature rather than from the prefix. A full data URI is accepted too.

Why does my string fail to decode?

Usually it is truncated by a copy that clipped the line, or it is URL-safe Base64 using hyphen and underscore instead of plus and slash. It may also be a non-image file such as a PDF or font.

Which image formats are supported?

PNG, JPG, GIF, WEBP and SVG. The format is detected from the decoded bytes, and the download is named with the matching extension automatically.

How big will the decoded file be?

Roughly a quarter smaller than the string, since Base64 inflates binary data by about a third when encoding. A 400 KB string produces an image of around 300 KB.

Is my string sent to a server?

No. Decoding happens in your browser's memory, so strings copied from production code or API responses never leave your machine.