Base64 to PNG Converter
Paste a Base64 string or full data URI to preview the image instantly and download it as a PNG file, with transparency preserved.
100% client-side. Nothing is uploaded — decoding happens in your browser.
How to convert Base64 to PNG
The whole process takes under a minute and never leaves your browser:
- Copy the Base64 string. Grab the full data URI (
data:image/png;base64,iVBOR...) or just the raw Base64 body — the converter accepts both and detects the source format automatically. - Paste it into the decoder above. You can paste directly, drag a .txt file onto the box, or click one of the sample chips to see the tool work before using your own data.
- Click Convert to PNG and download. You get an instant preview plus the exact dimensions, the decoded PNG file size, and the length of the Base64 input. Hit Download PNG to save a real .png file.
Base64 string vs. data URI: what's the difference?
A Base64 string is pure text: the binary bytes of an image re-encoded into 64 safe ASCII
characters (A–Z, a–z, 0–9, +, /), plus
= padding. It has no header, so on its own it does not say what format the bytes represent.
A data URI wraps that Base64 payload in a standard header:
data:image/png;base64, followed by the string. The header is what tells browsers, CSS, and HTML
exactly how to interpret the bytes. If you have the choice, paste the full data URI — it removes all guesswork.
A bare string still works here: the decoder sniffs the file signature (PNG starts with
iVBOR in Base64, JPEG with /9j/) and routes the decode accordingly.
One more thing worth knowing: Base64 makes data roughly 33% larger than the binary original. That overhead is the price of moving binary data through text-only channels — HTML, CSS, JSON, or email. When you decode back to PNG, the file shrinks back to its true size, which is exactly what the size readout above shows.
Base64 to PNG vs. Base64 to other formats
The decoder renders the source image and re-exports it, so the output format is your choice — not dictated by the input. Pick the format that matches what the image needs to do:
- PNG (this tool) — lossless and alpha-channel aware. Choose it for logos, icons, UI elements, screenshots, and anything that must stay pixel-exact or sit on a transparent background. If your Base64 came from a PNG, decoding to PNG is a perfect round trip: zero quality loss.
- JPG — much smaller files for photographs, but lossy and no transparency. Use the Base64 to JPG decoder when the image is a photo and file size matters more than pixel perfection.
- WebP — modern compression, supports both lossless and lossy modes plus transparency. The Base64 to WebP decoder is a good middle ground for web assets where you still want transparency at a smaller size.
- Original format — not sure what the string contains? The Base64 to Image decoder auto-detects PNG, JPG, GIF, WebP and SVG and saves in the source format.
- Going the other way? To encode a PNG file into a Base64 data URI, use the PNG to Base64 encoder.
Decode Base64 to PNG in code
Prefer to do it in your own toolchain? Every mainstream language ships a Base64 decoder. Here are the four most requested snippets (these match what people actually search for):
JavaScript (browser)
In the browser a PNG data URI is already a downloadable resource — no library needed. Bare Base64 needs the header re-attached first:
// Decode a Base64 PNG and trigger a download
const b64 = "iVBORw0KGgoAAAANSUhEUg..."; // bare Base64 or full data URI
const dataUri = b64.startsWith("data:")
? b64
: "data:image/png;base64," + b64;
const link = document.createElement("a");
link.href = dataUri;
link.download = "image.png";
document.body.appendChild(link);
link.click();
link.remove();
Python
import base64, re
raw = "iVBORw0KGgoAAAANSUhEUg..." # bare Base64 or data URI
raw = re.sub("^data:image/png;base64,", "", raw)
with open("image.png", "wb") as f:
f.write(base64.b64decode(raw))
C#
var b64 = "iVBORw0KGgoAAAANSUhEUg...";
// Strip a data URI header if present
if (b64.StartsWith("data:image/png;base64,"))
b64 = b64.Substring("data:image/png;base64,".Length);
byte[] bytes = Convert.FromBase64String(b64);
File.WriteAllBytes("image.png", bytes);
PowerShell
$b64 = "iVBORw0KGgoAAAANSUhEUg..."
$b64 = $b64 -replace '^data:image/png;base64,', ''
[IO.File]::WriteAllBytes("image.png", [Convert]::FromBase64String($b64))
All four assume the Base64 payload is a PNG (it starts with iVBOR). If your string came from a
JPEG or WebP source, the bytes you write out will be in that format — rename the extension accordingly, or run
it through this converter to re-export as a true PNG.
Private by design
Decoding uses the browser's native image handling — the string is turned into an image element locally and never sent anywhere. Nothing is uploaded, logged, or stored, so it is safe for confidential assets, internal tools, and production screenshots alike.
More Base64 converters
Frequently asked questions
How do I convert a Base64 string to a PNG?
Paste the Base64 string or full data URI into the box and click Convert to PNG. The source image is detected automatically and exported as a real .png file.
Does this decoder keep transparency?
Yes. PNG supports an alpha channel, so transparent areas in the original image are preserved in the downloaded .png file.
Is the decoder private?
Yes. Decoding happens entirely in your browser. Nothing is uploaded, so your data stays on your device.
Can I decode a Base64 string from a JPG or WebP into a PNG?
Yes. The tool renders whatever image the string contains and re-exports it as PNG. Keep in mind: converting a lossy source (JPG) to PNG does not restore lost quality — it just saves the current pixels in a lossless container. For a JPG source you may prefer the Base64 to JPG decoder.
Why is my downloaded PNG smaller than the Base64 string?
Base64 encoding inflates binary data by roughly 33% so it can travel through text-only channels. Decoding reverses that: the PNG file returns to its true binary size, which is why the size readout above shows the file lighter than the text you pasted.
What does a PNG Base64 string look like?
PNG files always start with the same 8-byte signature, which appears as iVBORw0KGgo at the start of the Base64 payload. JPEG strings start with /9j/. If your string starts with iVBOR, it is PNG data.