Decode Base64 back to an image
Paste a data URI or raw Base64 string to see the image and download the file. The format is detected from the bytes themselves.
- Runs in your browser
- Nothing is uploaded
- No sign-up
- No watermark
Drop a .txt file containing Base64
or paste your Base64 string in the box below
Plain text files up to 50 MB
Choose a .txt fileBefore
After
Processed image will appear here.
How to use the base64 image decoder
Paste a Base64 string or data URI into the box and the image appears immediately, ready to download with the correct extension. Data URIs, raw Base64, CSS url(...) rules, <img> tags and URL-safe variants are all accepted.
- Paste the stringA full data URI, a raw Base64 blob, or a CSS url(...) rule. You can also drop in a .txt file.
- Check the previewThe decoded image appears with its detected format and byte size.
- DownloadSave with the correct file extension.
About this tool
Base64 image strings turn up in API responses, CSS files, database columns and log output, usually when you need to see what the image actually is. Paste the string here and it is decoded in your browser.
Data URI prefixes, CSS url(...) wrappers, line breaks and URL-safe Base64 variants are all handled. When there is no MIME declaration, the format is identified from the file's magic bytes rather than guessed from context.
What you get
- Accepts data URIs, raw Base64, CSS url(...) and URL-safe variants
- Format detection from file signature, not from the string
- Tolerant of line breaks, quotes and missing padding
- Clear error messages for malformed input
- Decoding happens entirely in your browser
When to use the base64 image decoder
Inspecting an API response
Services that return images as Base64 fields are common. Paste the value to see what you actually received.
Extracting an image from CSS
Recover the original graphic from an inlined background-image rule.
Debugging a broken data URI
If an inlined image is not rendering, decoding it here tells you whether the string is malformed or the problem lies elsewhere.
Recovering images from a database dump
Base64 columns in an export can be turned back into files one at a time.
Accepted input formats
| Input | Example | Handled |
|---|---|---|
| Full data URI | data:image/png;base64,iVBOR… | Yes, MIME read from the prefix |
| Raw Base64 | iVBORw0KGgoAAAANSUhEUg… | Yes, format sniffed from bytes |
| CSS rule | background: url("data:image/…") | Yes, wrapper stripped |
| HTML img tag | <img src="data:image/…"> | Yes, attributes stripped |
| URL-safe Base64 | uses - and _ instead of + and / | Yes, translated |
| With line breaks | wrapped at 76 characters | Yes, whitespace ignored |
| Missing = padding | length not a multiple of 4 | Yes, padding restored |
How it works
Input is parsed in two passes. If a data: prefix is present, the declared MIME type is taken from it. The Base64 payload is then cut at the first character that cannot belong to the alphabet: the closing quote of an img src, the ); of a CSS rule, or trailing prose. Cutting rather than filtering matters, because trailing junk like alt="x" is itself made of legal Base64 characters and would silently corrupt the data if simply stripped character by character.
When there is no declared MIME type, the format is identified from the decoded bytes themselves, using the file signature: JPEG begins FF D8 FF, PNG begins 89 50 4E 47, GIF begins GIF, WebP is a RIFF container with WEBP at offset 8, and BMP begins BM. This is more reliable than trusting a declaration, which can easily be wrong when the string has been copied between systems.
Everything happens in your browser. The decoded result is only ever displayed as an image and offered as a download. It is never executed. Be aware that SVG is a scriptable format in general; this tool renders it as an image and does not run it, but treat SVG from untrusted sources with the same care you would any downloaded file.
Common problems and how to fix them
- It says the Base64 is not valid
- This is almost always a truncated copy. Make sure you selected the entire string including any trailing = padding, and nothing after it.
- It decodes but says it is not a recognised image
- The data is valid Base64 but not an image. It may be text, JSON or a PDF. Check what actually produced the string.
- The image looks corrupted or partial
- The string was cut short. Base64 truncated mid-file often still decodes to a partially valid image.
- My very long string makes the page sluggish
- A few megabytes of Base64 is a practical ceiling in a browser tab. Split the work or use a command-line tool for very large payloads.
- The downloaded file has the wrong extension
- The extension follows the detected format. If it looks wrong, the source data likely declared a MIME type that does not match its actual contents. The signature detection is the more reliable of the two.
Frequently asked questions
What input formats are accepted?
Full data URIs, raw Base64, CSS url("data:…") rules and URL-safe Base64 using - and _ instead of + and /. Whitespace, quotes and missing = padding are all handled.
How is the image format detected?
From the declared MIME type when there is one, otherwise from the file's magic bytes: FFD8FF for JPEG, 89504E47 for PNG, RIFF…WEBP for WebP, and so on.
Why do I get "not valid Base64"?
It is almost always a truncated copy or stray characters from the surrounding code. Make sure you copied the entire string, including the trailing = padding, and nothing after it.
Is it safe to decode strings from other people?
Decoding happens in your browser and the result is only ever displayed as an image, never executed. Be cautious with SVG from untrusted sources, since SVG can carry scripts. This tool shows it as an image and does not run it, but do not open the downloaded file in a context that would.
Is there a size limit?
Very long strings will slow the page down; roughly a few megabytes of Base64 is a practical ceiling in a browser tab.
How do I convert Base64 back to an image?
Paste the string into the box above. The image is decoded in your browser and appears immediately with a download button.
Can I decode several strings at once?
No, decode them one at a time. You can also drop a .txt file containing a single Base64 string.