Base64 to Image
Decode a Base64 string back into a viewable, downloadable image.
You have found a long string of gibberish in an API response, a database column or someone else’s stylesheet, and you suspect it is an image. Paste it here and find out.
Decoding Base64 back to a picture
- Copy the Base64 string you want to decode.
- Paste it into the box above. The
data:image/png;base64,prefix is fine to include or leave out. - Decode it and look at the preview.
- If you get an error, check for line breaks or stray spaces that crept in during copying.
- Download the image file.
What to do when it will not decode
The overwhelming majority of failures come from a damaged string rather than a broken tool. Copying Base64 out of a terminal, an email or a code editor often introduces line breaks, and pasting from a chat client can silently convert characters.
Check three things in order: that the string contains only letters, digits, plus, slash and trailing equals signs; that no line breaks survived the copy; and that you got the whole thing, including the padding at the end. If it came from a URL it may be Base64url encoded, in which case the - and _ characters need converting back to + and / first.
Where Base64 images turn up
- Inside CSS files, embedded as background images with a data URI.
- In API responses that return avatars or thumbnails as JSON fields.
- In database columns where somebody stored the image rather than a path.
- In email source, where inline attachments are Base64-encoded by MIME.
- In configuration files and deployment manifests carrying a logo.
Questions about decoding images
How do I know what image format the string contains?
If it is a full data URI, the prefix tells you — data:image/png;base64, means PNG. Without a prefix, the decoder can usually detect the type from the first few bytes of the decoded data.
Why am I getting an invalid Base64 error?
Almost always a copy-paste problem: stray line breaks, missing characters at the end, or a truncated string. Re-copy the whole value in one go and try again.
What is Base64url and why does it fail here?
Base64url swaps + and / for - and _ so the string is safe inside a URL. Convert those two characters back before decoding and it will work.
Can I decode a very large string?
Yes, within the limits of your browser’s memory. Very large embedded images may take a moment to render but will decode correctly.
Is the data sent to a server?
Yes. The string is sent to the server for decoding, but your data is not stored once processed.