Base64 to Image
Paste Base64 text, with or without the data URL prefix, and preview the image it contains. The tool detects the real format from the file signature and lets you download it with the right extension.
Runs in your browser. Your files are never uploaded.
Loading Base64 to Image…
How to use Base64 to Image
- Paste the Base64 string or full data URL into the box.
- Wait a moment for the preview to appear below.
- Check the detected format and size.
- Press Download to save the image file.
Reading Base64 images
Developers meet Base64 images in API responses, database exports, HTML emails and CSS files. The strings are long and unreadable, so it is hard to tell what picture they hold, or whether they are valid at all. Pasting the string here converts it back into the binary file and renders it, which makes debugging fast.
The decoder first removes whitespace and any data URL header, converts URL-safe characters to the standard alphabet, and checks that the length makes sense. Then it turns the text into bytes and compares the first few against known file signatures. For instance, PNG files begin with the bytes 89 50 4E 47, and JPEG files begin with FF D8 FF.
Troubleshooting a string that will not decode
- Check that the whole string was copied. A cut-off string causes an incomplete length error.
- Remove quotes, commas or JSON escape sequences such as backslash-n around the value.
- Make sure the text is Base64 of an image and not Base64 of JSON or text that merely contains an image reference.
- If it decodes but is not recognised, it may be a different file type such as PDF.
- Very large strings can be slow to paste on mobile devices; try a desktop browser.
Safety and privacy
SVG images are shown only through a normal image element, which means scripts inside the SVG cannot run and external files are not loaded. The decoded file is created as a temporary local object in your browser and released when you change the input.
Nothing is uploaded, so you can safely inspect images from private systems. As always, avoid opening files from sources you do not trust, and remember that downloading a decoded file saves it exactly as the bytes were supplied.
Why use this base64 to image tool
- Detects the real type. Reads the first bytes to identify PNG, JPEG, GIF, WebP, BMP, ICO, AVIF or SVG, even if the prefix is wrong or missing.
- Accepts messy input. Ignores line breaks and spaces, and understands URL-safe Base64 that uses dashes and underscores.
- Clear errors. Tells you when the text is truncated, has illegal characters or is not an image.
- Offline decoding. Decoding is done in your browser, so the content stays on your device.
Frequently asked questions
Do I need to include the data:image/png;base64, prefix?
No. You can paste either the full data URL or just the encoded characters. When the prefix is missing, the tool works out the format by checking the decoded bytes.
Why does it say the data is not a known image format?
The text decoded successfully, but the bytes did not match any supported image signature. Common causes are a truncated string, a Base64 copy that includes extra characters, or content that is a PDF, a font or some other file type.
What if the declared type and detected type differ?
Sometimes a string claims to be image/png while the file is really a JPEG. The tool trusts the actual bytes and saves the file with the matching extension, and shows a note so you know about the mismatch.
More free tools
Image Compressor
Reduce image file size up to 90% without visible quality loss. Compress JPG, PNG and WebP in your browser. Free, private, batch download.
Open toolCrop Image
Crop any photo online with a drag-to-select box and presets for 1:1, 4:3 and 16:9. Works on phones, runs in your browser, so your image is never uploaded.
Open toolRotate & Flip Image
Rotate an image 90, 180 or 270 degrees or flip it horizontally or vertically, then download it as PNG or JPG. Free, instant and done in your browser.
Open tool