Base64 Decoder

Base64 to Image Converter

Paste any base64 string or data URI to preview and download the decoded image. Supports raw base64 and full data:image/... format. Everything runs locally.

Raw + URI

Full Support

Live

Preview

Auto

Detection

Private

No Uploads

Decoding happens locally in your browser. Nothing is sent anywhere.

Decoding happens locally in your browser. Nothing is sent anywhere.

Where base64 image strings come from

If you need to decode a base64 image, it probably arrived from one of these sources. Here is how to find and copy the string correctly from each.

API or JSON response

Copy the value of the field containing the image. It will be a long string of letters and numbers. Paste it directly. The tool handles both raw base64 and data URI format.

HTML source code

Right-click the page and choose View Page Source (Ctrl+U on Windows, Cmd+U on Mac). Search for "data:image" to find embedded images. Copy the entire string from data: through to the closing quote.

CSS stylesheet

Open browser DevTools, find the stylesheet, search for "url(data:". Copy everything inside the url() parentheses including the data: prefix.

Database or log file

Copy the base64 string value exactly. Watch out for line breaks that may have been inserted for readability. Remove any whitespace or newlines from the string before pasting.

Email source

View the raw email source. Images in HTML emails are often embedded as base64 data URIs. Copy the full data:image/...;base64,... string from the src attribute of an img tag.

Troubleshooting common issues

Error: invalid base64 string

The string contains characters that are not valid in base64. Valid characters are A-Z, a-z, 0-9, plus (+), slash (/) and equals (=). Remove any spaces, line breaks, quotes, HTML entities like & or angle brackets that may have been included when copying.

The decoded image looks corrupted or wrong

The string may be truncated. Base64 strings for images can be very long. Make sure you copied the entire string from the first character to the last without cutting anything off. Select all before copying rather than manually highlighting.

Wrong image format detected

When pasting raw base64 without the data: prefix, the tool detects the format from the binary signature in the encoded data. If the detected format is wrong, paste the full data URI format (data:image/png;base64,... or the appropriate MIME type) so the tool knows the format explicitly.

The string is very long and hard to copy

If you are working with a file, it may be easier to use the Image to Base64 tool on this site to encode the original file and check the output, rather than trying to copy a long embedded string from source code.

Frequently asked questions

What is a data URI?

A data URI is a string that encodes a file's content directly inside a URL. For images, it looks like this: data:image/png;base64,iVBORw0KGgo... The data: prefix tells the browser this is inline data rather than an external URL. The image/png part is the MIME type telling the browser what kind of data it is. The base64 label indicates the encoding method. Everything after the comma is the base64-encoded file content.

What is the difference between a raw base64 string and a data URI?

Raw base64 is just the encoded content, for example iVBORw0KGgo... A data URI wraps that content with a prefix that identifies the MIME type: data:image/png;base64,iVBORw0KGgo... This tool accepts both formats. If you paste a raw base64 string without the data: prefix, it will attempt to detect the image format automatically from the binary signature in the encoded data.

What image formats can be decoded?

PNG, JPEG, WebP, GIF, SVG and BMP can all be decoded. The format is read from the MIME type in the data URI prefix when present. For raw base64 strings without a prefix, the tool detects the format by examining the binary signature in the first few bytes of the decoded data.

Why do I need to decode a base64 image?

Common reasons include: an API returned an image as a base64 string and you want to see or save it; you found a data URI embedded in HTML or CSS source code and want to extract the image as a file; you are debugging an application that encodes images before storing or transmitting them; or you received a base64 string in a log or database export and need to verify what image it represents.

My base64 string shows an error. What is wrong?

The most common cause is the string being truncated or having extra characters added during copying. Base64 strings should contain only letters A to Z, a to z, digits 0 to 9, plus (+), slash (/) and equals (=) for padding. Spaces, line breaks, quotes and HTML entities must be removed. If you copied from a web page, try copying from the raw page source instead, since some characters may have been converted by the browser's rendering.

Is my base64 string sent to a server?

No. Decoding happens entirely in your browser using the built-in atob() function, which converts base64 text back to binary data locally. Nothing is sent to any server. You can disconnect from the internet after the page loads and the tool still works.