Base64 Image Converter
Convert an image to Base64 text (with an optional data URI prefix, ready to paste into CSS or HTML), or paste Base64 back in to decode and download a real image file. Image format is detected automatically — from a data URI prefix, or sniffed from the raw byte signature when there isn't one — with a manual picker if it genuinely can't be determined. Runs entirely in your browser — nothing is uploaded.
Converts instantly — nothing is uploaded, it never leaves your browser.
About this tool
This tool converts between an image file and its Base64 text representation, in both directions. Base64-encoding an image turns its raw bytes into plain text that's safe to embed directly in CSS, HTML, JSON, or a database column — no separate file to host — which is exactly what a CSS data URI background-image or an inline <img src="data:..."> is under the hood. Going the other way, paste that Base64 text (with or without the "data:image/png;base64," prefix) back in and get a real, downloadable image file out. Since raw Base64 alone carries no format metadata, this tool sniffs the actual image format from the decoded byte signature (the same technique real file-type detectors use) whenever there's no data URI prefix to read it from directly — and if that sniffing genuinely can't tell, it asks you to pick the format manually rather than silently guessing wrong. It runs entirely client-side — your image and Base64 data are converted locally in your browser and never uploaded anywhere.
Supported formats
- PNG — Detected from its 8-byte signature — lossless, supports transparency.
- JPEG — Detected from its 3-byte signature — the common photo format.
- GIF — Detected from its signature, including animated GIFs.
- WEBP — Detected by checking its RIFF/WEBP container markers.
- BMP — Detected from its 2-byte signature.
- SVG — Detected by sniffing for XML/<svg> content, since it's text rather than a fixed binary signature.
- ICO — Detected from its signature — favicon files.
What you can do
- Convert an image to Base64, or Base64 back to a downloadable image
- Automatic image format detection — from a data URI prefix, or sniffed from the raw bytes
- Copy the Base64 or full data URI in one click
- Download the Base64 as .txt, or the decoded image in its original format
- Nothing is uploaded — every conversion happens locally in your browser
How to use
Step 1
Pick a direction
Image → Base64 to encode a file, or Base64 → Image to decode text back into an image.
Step 2
Upload or paste
Upload an image file, or paste Base64/a data URI — conversion happens instantly, no button to press.
Step 3
Copy or download
Copy the text, download it as .txt, or download the decoded image in its original format.
Example
A tiny PNG's Base64 encoding looks like this:
Base64
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=
which this tool detects as PNG from its byte signature and decodes straight back into a downloadable image — or, as a full data URI, becomes "data:image/png;base64,iVBORw0KGgo...", ready to paste directly into a CSS background-image or an <img> tag.
How your data is handled
This tool is labeled 🟢 Browser: your image and Base64 data are read and converted directly using your browser's File API and standard Base64 decoding — nothing is uploaded to a server, and nothing about it is retained once you leave the page.
Frequently asked questions
What's the difference between the Base64 output and the Data URI?+
The raw Base64 is just the encoded bytes. A data URI adds a "data:image/png;base64," prefix declaring the format, which is what you actually need to paste into an HTML <img src="..."> attribute or a CSS background-image — click "Generate Data URI" to switch the output to that form.
Why does it ask me to pick the image format manually?+
Raw Base64 with no data URI prefix carries no format information at all — this tool sniffs the format from the decoded byte signature (the same technique real file-type detectors use), which works for PNG, JPEG, GIF, WEBP, BMP, ICO, and SVG. If the pasted data doesn't match any of those signatures (a corrupted paste, a non-image file, or a format outside that list), you're asked to pick manually rather than the tool guessing wrong.
Why does the preview say it can't decode as a valid image?+
The Base64 decoded successfully and a format was determined (or picked), but the resulting bytes still aren't a valid image the browser can render — usually a truncated paste, a copy/paste that dropped or altered characters, or Base64 that was never actually image data in the first place.
Is there a file size limit?+
No hard limit, but Base64 encoding inflates size by roughly 33% over the original binary, and very large images can make the browser feel sluggish rendering that much text — this tool works best for the icons, small graphics, and thumbnails that data URIs are actually meant for.
Is my image or Base64 data uploaded anywhere?+
No — every conversion happens directly in your browser using standard Base64 encoding/decoding and the File API. Nothing you upload or paste here ever leaves your device.