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.

Last updated: August 2026

Raw + URI

Full Support

Live

Preview

Auto

Detection

Private

No Uploads

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

How to decode base64 to an image

1

Paste your string

Raw base64 or full data:image/...;base64,... format, both work.

2

Click Decode image

Decoded locally with atob(), nothing is sent anywhere.

3

Check the preview

Dimensions, format and file size appear alongside the image.

4

Download

Saves with the correct extension for the detected format.

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 decoded 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.

Common base64 decoding mistakes

Assuming metadata gets stripped like other tools on this site

Most converters here decode to pixels and re-encode, which drops EXIF and GPS data. This tool doesn't, it's a direct byte passthrough. If the original file had metadata baked in, it's still in the decoded output.

Copying a base64 string that a console or log viewer truncated

Browser dev tools and terminal loggers often shorten very long strings with an ellipsis in the middle to keep output readable. If the decoded image looks wrong or the tool throws an error, check whether the source actually gave you the full string.

Expecting raw base64 without a prefix to auto-detect SVG

SVG has no binary magic-byte signature to detect, unlike PNG or JPEG. Paste the full data:image/svg+xml;base64,... URI for SVG rather than the raw base64 alone.

Leaving stray HTML-encoded characters in the pasted string

Copying from rendered HTML source can leave behind entities like & or extra quote marks around the string. These aren't valid base64 characters and will cause a decode error.

Not removing line breaks inserted by editors or log viewers

Some tools wrap long base64 strings across multiple lines for display. Those line breaks aren't part of the actual data and need to be stripped before pasting here.

Why use ImgTweak?

Runs entirely in your browser
No uploads, ever
Preserves original EXIF and metadata, no re-encoding
Accepts raw base64 and full data URIs
Free forever, no account needed
Works on mobile as well as desktop

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 attempts to detect the image format automatically from the binary signature in the decoded data.

What image formats can be decoded?

PNG, JPEG, WebP, GIF, BMP and SVG 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 PNG, JPEG, WebP, GIF and BMP from the binary signature in the first few bytes of the decoded data.

Can raw base64 without a prefix be auto-detected as SVG?

No. SVG is a text format, not a binary one, so it has no magic-byte signature the way PNG or JPEG do. If you paste raw base64 with no data: prefix, SVG can't be reliably auto-detected. Paste the full data:image/svg+xml;base64,... URI instead so the format is read directly from the prefix.

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.

Does the decoded image keep its original EXIF and GPS data?

Yes, and this is different from most other tools on this site. This decoder doesn't draw the image to a canvas and re-encode it, it decodes the base64 text straight back to the original binary bytes. Whatever metadata, including EXIF and GPS, was present when the file was originally encoded to base64 is still there in the decoded output.

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.

Ready to decode your base64 string?

No sign-up. No upload to server. Paste your string above and download the image in seconds.