How to use
- Paste the Base64 string or the full data:image/png;base64 URI.
- Check the preview. Transparent areas appear over a checkerboard pattern.
- Leave the download format on PNG. If the data is JPEG, WebP or another format, it is converted to PNG in your browser.
- Download the .png file.
Where Base64 PNGs come from
PNG is the format you are most likely to meet as Base64. Calling canvas.toDataURL() without arguments returns a PNG data URI. Browser automation tools hand screenshots back as Base64 PNG, for example page.screenshot({ encoding: 'base64' }) in Puppeteer or get_screenshot_as_base64() in Selenium. Chart renderers, QR code generators and image generation APIs often return the picture as a Base64 field inside JSON.
A PNG string is easy to recognise: it always begins with iVBORw0KGgo, the encoding of the 8-byte PNG signature that starts with 89 50 4E 47. It is followed by AAAANSUhEUg, which is the start of the IHDR chunk holding the width and height.
Strings copied out of JSON need a quick check first. PHP's json_encode, for example, escapes forward slashes by default, so a PNG from a PHP API may arrive with \/ sequences. Replace them with / and remove the surrounding quotes before pasting.
Why save as PNG
PNG compresses without losing any detail and stores a full alpha channel, so soft shadows and anti-aliased edges stay intact. That makes it the natural choice for screenshots, interface elements, diagrams and anything containing text. For photographs, JPG or WebP produce much smaller files.
Converting a JPEG or WebP to PNG keeps exactly what is on screen, but it cannot bring back detail that lossy compression already removed, and the PNG is usually larger than the source.
Save a Base64 PNG in code
# Python
import base64
with open('screenshot.png', 'wb') as f:
f.write(base64.b64decode(b64_string))
// Browser: data URI to Blob, without manual decoding
const blob = await (await fetch(dataUri)).blob();
const url = URL.createObjectURL(blob);
Need the opposite direction? PNG to Base64 encodes a file into a string or data URI.
Frequently asked questions
How can I tell if a Base64 string is a PNG?
iVBORw0KGgo. The tool also reads the signature bytes directly, so it reports the real format even if the data URI says something else.Does converting to PNG reduce quality?
No. PNG is lossless, so the pixels are stored exactly as the browser decoded them. The only loss would be one that already happened in the source file.
Is transparency kept?
Yes. PNG output keeps the full alpha channel. JPEG output fills transparent areas with white, and GIF output reduces each pixel to either fully transparent or fully opaque.
My PNG data URI shows a broken image. What is wrong?
\/ before pasting.