Base64 to Image Converter

Paste a Base64 string or data URI and get the image back, previewed and ready to download with the right extension.

Base64 to image
Preview

What this tool does

To convert Base64 to an image, paste the string - with or without the data:image/...;base64, prefix - and the picture appears. The tool checks the first bytes to identify PNG, JPEG, GIF, WebP, BMP, ICO, AVIF or SVG, then lets you download it with the correct extension. It decodes in your browser and nothing is uploaded.

Cleans the pasted text, decodes the Base64 to bytes and identifies the format from its signature.

Shows a preview with the pixel size and file size, and offers the image as a download.

How to use it

  1. Paste the Base64 string or the whole data URI into the box.
  2. Check the preview and the details under it.
  3. Press Download image.

Why use this converter

Decodes a Base64 string or a full data: URI and shows the picture, so you can see what the text really contains before using it. Images embedded as Base64 in HTML, CSS, JSON or API responses are unreadable as text. Decoding them lets you see the picture, check what an API sent, and recover a file you only have as a string.

Why we built it

We built the Base64 to image converter to decode a string or a full data URI and preview it, so you can see what the text contains. Encode pictures with the image to Base64 tool and decode text with the Base64 converter.

Who this tool is for

  • Developers debugging data URIs
  • Support staff opening an embedded image
  • Students learning encodings

When to use it

  • Checking what image an API or a database field actually holds.
  • Extracting an embedded image from CSS, HTML or an email.
  • Recovering a picture stored as text in a log or a JSON file.
  • Debugging a data URI that does not display.

How it works

If the text starts with a data: prefix it is removed, along with any url("...") wrapper or quotes, and whitespace and line breaks are ignored. URL-safe Base64 (with - and _ instead of + and /) is converted back and missing = padding is restored.

The decoded bytes are matched against known file signatures: PNG starts 89 50 4E 47, JPEG FF D8 FF, GIF "GIF8", WebP "RIFF....WEBP", BMP "BM", and SVG is recognised by its <svg tag. The type found here decides the file extension, not the prefix in the pasted text.

If the string decodes but is not an image, the tool says so rather than offering a broken file. A string cut short often decodes but fails to display.

What you give it, and what you get back

Input and output of Base64 to Image Converter
ItemDetails
InputBase64 text, a data: URI, a CSS url(...) value or URL-safe Base64.
DetectionPNG, JPEG, GIF, WebP, BMP, ICO, AVIF, SVG and PDF are recognised from the decoded bytes.
PreviewThe image with its pixel dimensions and file size.
OutputA download named decoded-image with the correct extension.

Issues you may run into

Common problems with Base64 to Image Converter
What you seeWhy it happensWhat to do
"That does not look like Base64"The text contains characters other than letters, digits, + / and =.Remove stray text around the string, such as quotes, labels or JSON keys.
Decodes but is not an imageThe data is another kind of file or encrypted data.Check the source; try the Base64 encoder/decoder to view it as text.
Image appears broken or partly drawnThe string was cut short when copied.Copy the complete string again, including the end.
Wrong colours or a blank imageSome tools store raw pixels rather than an image file.This tool needs a complete image file (PNG, JPEG and so on).

Assumptions and limitations

Frequently asked questions

How do I convert a Base64 string to an image?

Paste the string into the box. The image appears at once and you can download it.

Do I need to include the data:image prefix?

No. It works with or without the prefix.

How does it know the file type?

It reads the first bytes of the decoded data, which are different for each format, so the extension is correct even if the prefix says otherwise.

Why does my string not decode?

It probably has extra characters, such as quotes or a JSON key, or it was truncated. Paste only the Base64 part.

Is my image uploaded?

No. The decoding is done in your browser.

Can I go the other way?

Yes - use the Image to Base64 tool to turn a picture into a string or data URI.