What is Base64 to image conversion?
Base64 is a way of representing binary data — like an image file — as a long string of plain ASCII characters. Going from Base64 back to an actual image means decoding that string into the original bytes of the file: a PNG, JPEG, WebP, GIF, BMP, or SVG. Once decoded, the bytes can be displayed as a normal image, saved to disk with the correct file extension, or copied as a clean data:image/…;base64,… data URI for use in HTML, CSS, or Markdown.
This converter accepts a Base64 string in any of the common forms — raw, wrapped as a data URI, or in the URL-safe variant — and decodes it entirely inside your browser. You see the resulting image immediately, along with the detected file format and dimensions, and you can download it as a real file with one click.
When you’d need to convert Base64 back to an image
The most common situations:
- Inspecting a data URI from a website’s source. You spotted a Base64-encoded image inside a CSS file, an HTML attribute, or a JSON payload, and you want to see what it actually is.
- Recovering an image from a log file or database dump. Many systems store inlined images as Base64 inside structured records — decoding lets you view them.
- Verifying that a Base64 string in your code is correct. A live preview confirms the data is intact and renders the image you expected, not a corrupted file.
- Reading a Base64 attachment from a MIME email or API response. Email and many REST APIs use Base64 for binary payloads.
- Reverse-engineering a small icon a designer hardcoded as a data URI so you can save it back to a regular file.
- Saving a generated image from a tool that only outputs Base64 — turning the text string back into a downloadable PNG or JPG.
How to convert Base64 to an image
- Paste your Base64 string into the input box at the top of this page. You can paste raw Base64, a full
data:image/…;base64,…data URI, or the URL-safe variant that uses-and_instead of+and/. Whitespace and line breaks are stripped automatically. - Wait for the live preview. The converter decodes within ~200 ms of finishing your paste and shows the image with its detected format and dimensions.
- Download the file using the “Download as PNG/JPG/WebP/…” button. The extension matches the actual format of the bytes, not whatever the data URI prefix claimed.
- Or copy a clean data URI if you need the string back in canonical form — useful when the original data URI you pasted had the wrong MIME prefix or extra whitespace.
Everything happens in your browser. The Base64 string never leaves your device, and the decoded image bytes live only in the browser’s memory until you close the tab.
Image formats this converter decodes
Base64 to PNG
PNG is the most common format people encode as Base64 because it is lossless and supports transparency. The decoder identifies a PNG by its signature bytes (89 50 4E 47) and downloads the file with a .png extension. Animated PNG (APNG) is also handled correctly — if the browser supports APNG playback, the preview animates.
Base64 to JPG / JPEG
JPEG is identified by its FF D8 FF magic bytes regardless of what the data URI prefix says. The decoded file downloads as .jpg. JPEG progressive scans, all standard color spaces (RGB, CMYK, grayscale), and embedded EXIF metadata are preserved exactly — the converter passes the bytes through without re-encoding.
Base64 to WebP
WebP files start with RIFF…WEBP and are detected from those bytes. Both lossy and lossless WebP are supported, as are animated WebP files in browsers that play them back. The download arrives as .webp.
Base64 to GIF
GIFs are detected from the GIF8 signature and downloaded with a .gif extension. Animated GIFs animate in the preview the moment they are decoded — no re-encoding, no frame loss.
Base64 to BMP
BMP is identified by its BM magic bytes and saved with a .bmp extension. BMP is rarely the right format for images on the web, but the decoder supports it for completeness when working with legacy data.
Base64 to SVG
SVG is plain XML, so the converter detects it by attempting to decode the first 512 bytes as UTF-8 and looking for the <svg or <?xml markers. Detected SVGs render in the preview just like raster images and download as .svg. Because SVG is text, you can also open the downloaded file in any code editor to inspect or edit the markup.
Base64 to ICO
Favicon (.ico) files are detected and downloaded with the correct extension. Useful when reverse-engineering favicons embedded as data URIs in HTML <link rel="icon"> tags.
Why magic-byte detection matters
Many Base64 decoders trust the data URI prefix to determine the file format — if the prefix says data:image/png, they save the result as a PNG, even if the bytes are actually a JPEG that someone mislabeled. That produces silently broken files: an image viewer might still display them by sniffing internally, but anything that goes by the file extension breaks.
This converter trusts the bytes, not the label. The first few bytes of the decoded buffer are checked against known signatures (the same approach browsers and operating systems use), and the detected MIME — not the user-supplied prefix — drives the file extension, the download dialog, and the canonical “Copy Data URI” output. If you paste a JPEG with a data:image/png prefix, the tool will tell you the bytes are actually JPEG and save them as decoded.jpg.
Raw Base64 vs. full data URI: what should you paste?
Either works. The two forms are:
- Raw Base64: a string of letters, digits,
+,/, and=padding — for exampleiVBORw0KGgoAAAANSUhEUgAA…. The converter detects the format from the bytes, no prefix needed. - Full data URI: starts with
data:image/…;base64,followed by the same string — for exampledata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…. The prefix is stripped automatically before decoding.
If your input came from a CSS rule (background-image: url("data:…");), an HTML src attribute, or a JSON field with a wrapping prefix, you can paste the entire fragment — the converter cleans it up for you.
What about URL-safe Base64?
Some systems — JWTs, OAuth flows, certain APIs — use a URL-safe Base64 variant where + is replaced with -, / with _, and the trailing = padding is sometimes stripped. The converter detects this variant and translates it back to standard Base64 before decoding, with no extra step required from you.
Is it safe to decode sensitive Base64 strings here?
Yes. The decoding pipeline is the browser’s built-in atob function, plus a Blob and an in-memory object URL. Nothing is sent over the network, no analytics is fired on the input, and the page works offline once it has loaded. After you close the tab, the decoded bytes are gone from memory; nothing is cached on disk. Treat the page like any other local utility.
What if my paste is not actually an image?
If the magic-byte check does not match a known image format, the converter surfaces a friendly error and points you at the general-purpose Base64 Decoder, which handles arbitrary text and file inputs. The image-only focus of this page is intentional: the live preview is unambiguous, the download has the right extension, and you avoid the foot-gun of saving non-image bytes with an image extension.
Related tools
If Base64 decoding is part of a longer workflow, these companion tools cover the adjacent jobs:
- Image to Base64 Converter — the reverse direction. Encode any image to Base64 with optional WebP/JPEG re-compression to shrink the output.
- Base64 Encoder — encode plain text or any file (not just images) to Base64.
- Base64 Decoder — decode arbitrary Base64 strings, including non-image data such as JSON, text, PDFs, or any file type.
- JPEG Compressor, PNG Compressor, WebP Compressor — shrink the decoded image after you save it, if size matters.
- JPG to WebP, PNG to WebP — convert the decoded file to WebP for smaller hosting.