Base64 to Image Converter
Decode a Base64 string or data URL back into a viewable image and download it as PNG, JPG, WebP or GIF. Runs in your browser.
Reviewed by Aygul Dovletova · Last reviewed
How to Use the Base64 to Image Converter
- Paste your Base64 string into the textarea. Either a full data URL (starts with
data:image/...;base64,) or the raw encoded payload works - this base64 image decoder auto-detects the format. - Click "Decode Image". The string is validated, the format is detected from either the data URL prefix or the magic bytes at the start of the decoded payload, and an image element renders the result.
- Inspect the info panel: detected MIME type, decoded byte size, and pixel dimensions read from the rendered image.
- Download the file. The decoded binary is wrapped in a
Blobwith the detected MIME type and offered through a temporary object URL, exactly as if the image came off disk. - Try another string by pasting over the textarea - there is no need to refresh the page between decodes.
Base64 to Image Converter: What It Does
This Base64 to image converter takes any Base64-encoded image payload and turns it back into a viewable, downloadable file. It accepts two shapes of input interchangeably: a full data URL like data:image/png;base64,iVBORw0KGgo... copied out of HTML, CSS, or DevTools, or the raw Base64 payload on its own with no prefix, pulled from a JSON API response, a YAML secret, or a database text column. Either way, the tool runs the string through atob, assembles the bytes into a typed array, and hands them to the browser as a Blob so an <img> tag can render the result and a download link can save it to disk. It is the inverse of our image to Base64 converter; together they cover the full round-trip for PNG, JPG, WebP, GIF, and SVG.
What Happens During Decoding
Decoding Base64 is the inverse of encoding: every four ASCII characters in the payload translate back to three bytes of binary, stripping padding "=" characters at the end. The browser exposes a native decoder through atob, which takes a Base64 string and returns a "binary string" with one char per byte - a legacy API older than typed arrays. We convert that binary string into a Uint8Array by iterating charCodeAt, which gives us the raw bytes in a modern form.
Format detection runs two paths in parallel. First, if the input is a data URL, we parse the MIME type from the data:MIME;base64, header - the cheapest and most reliable source. Second, we look at the magic bytes of the decoded payload: 0xFFD8 for JPEG, 0x89PNG for PNG, "GIF8" for GIF, "RIFF" + "WEBP" for WebP, and the SVG XML prelude for vector. This double-check handles malformed data URLs (claimed PNG that is actually JPEG) and raw Base64 where no MIME declaration is present. The final Blob is created with the detected type and rendered via URL.createObjectURL.
Where Decoding Base64 Actually Comes Up
- Extracting an image embedded in an HTML email source you are debugging - the image was inlined as a data URL and you need to save it as a real file.
- Recovering an attachment from a raw MIME message where the Content-Transfer-Encoding is Base64 but you have no mail client to parse it for you.
- Pulling images back from API responses that return screenshots as Base64 strings (common in headless browser APIs, Playwright traces, and some cloud vision APIs).
- Visualizing image data you extracted from a database
BLOBcolumn that was stored Base64-encoded to survive a text-oriented migration tool. - Inspecting an image that was embedded into a JSON or YAML config (Kubernetes Secrets, GitHub Actions artifacts) as inline data.
- Converting Base64 pasted out of a browser\'s DevTools "Copy image as data URL" right-click menu into a downloadable file.
Common Decoding Errors
- Truncated string. If the paste is cut off midway,
atobthrows InvalidCharacterError. Re-check your source - long data URLs in JSON are often cut at a line-length limit. Copy with a tool that preserves the whole string, likepbpasteon macOS or a proper clipboard manager. - Invalid characters. Whitespace, newlines, or stray HTML entities (like
/for /) can appear when you copy from an HTML-rendered source. The tool trims whitespace and normalizes line breaks, but stray escaped entities will still fail. - Wrong padding. Base64 must end with zero, one, or two "=" padding characters so the length is a multiple of 4. Raw Base64 strings from URL contexts use URL-safe variants with "-" and "_" - the tool auto-converts those.
- Not actually an image. If someone hands you a Base64 string of a PDF, a zip file, or a random blob, the decoder runs fine but the image tag fails to render. The info panel will show the detected MIME type as
application/pdforapplication/octet-streamso you know. - Very large strings. A 20 MB Base64 string (roughly 15 MB of binary) can cause noticeable latency on the decode step because
atobis synchronous.
Where Base64 Images Come From
The data URL scheme was defined in RFC 2397 in 1998 and Base64 itself (RFC 4648) goes back to the 1992 MIME spec, which is why encoded images turn up in email, JSON APIs, YAML configs, XML protocols, CSS background-image rules, localStorage blobs, and database text columns. Modern binary channels like multipart uploads and WebSocket frames exist, but Base64 survives as the universal fallback that passes through anything ASCII-safe.
When Dedicated Tools Beat Browser Decoding
For single decodes, the browser is ideal: paste, click, download. For repeated work, the CLI wins: echo "iVBOR..." | base64 -d > image.png on macOS and Linux, or [IO.File]::WriteAllBytes("image.png", [Convert]::FromBase64String("iVBOR...")) on Windows PowerShell. For MIME email forensics reach for munpack, and for multi-step encoding chains use CyberChef. Use this converter for one-off decodes; scale out to the CLI when you have a batch.
Frequently Asked Questions
What if my Base64 string does not have the data URL prefix?
That is fine - paste the raw encoded payload directly. The tool checks whether the input starts with <code>data:</code> and branches: if yes, MIME type comes from the header; if no, the decoder reads the first few bytes of the decoded payload and sniffs the format from magic bytes (FFD8 for JPEG, 89504E47 for PNG, RIFF...WEBP for WebP, 47494638 for GIF). The downloadable output is labeled with the correct MIME either way.
Why did my decode fail with "InvalidCharacterError"?
The string contains characters that are not valid Base64: whitespace in the middle (newlines, spaces), HTML entities that were not unescaped (like <code>&#x2F;</code>), or truncation from a copy that was cut short. The tool strips outer whitespace automatically, but internal garbage characters cause failure. Copy the string again using a clipboard manager that does not mangle whitespace.
Does the tool store the decoded image or send it to a server?
No. The Base64 string is decoded locally with <code>atob</code>, wrapped in a <code>Blob</code>, and exposed via a local object URL. No network request carries decoded bytes, no server stores your image, and no analytics payload references the content. Open DevTools and watch the Network tab stay empty during a decode.
Can I decode URL-safe Base64 (with - and _ characters)?
Yes. The tool auto-converts URL-safe Base64 (RFC 4648 Section 5, used in JWT tokens, OAuth flows, and URL-embedded data) to standard Base64 by replacing "-" with "+" and "_" with "/". It also adds missing padding if the string length is not a multiple of four, because URL-safe variants often omit the "=" padding to save bytes.
What if the decoded content is not really an image?
The decoder will still succeed - it just converts ASCII back to bytes without judging what those bytes mean. The format sniffer then fails to match a known image signature and reports <code>application/octet-stream</code>. The preview shows a broken-image icon, but you can still download the bytes and inspect them with a hex editor or <code>file</code> command to see what you actually have.
Is there a size limit on the input string?
Practical limit is around 30-50 MB of Base64 string (roughly 20-35 MB of binary). Above that, the synchronous <code>atob</code> call starts to block the UI noticeably, and copying a string that large into the textarea may be slow. For large binaries, use <code>base64 -d</code> on the command line instead of a browser tool.
Why does pasting a data URL from DevTools sometimes break?
Browser DevTools sometimes add line breaks to long copied strings for display purposes. The tool strips those automatically, but other tools may insert other whitespace or escape sequences. If a direct paste fails, try cleaning the string in a text editor with "trim whitespace" and "remove line breaks" first.
Can the tool decode Base64-encoded SVG?
Yes. SVG is text (XML), but when it is Base64-encoded inside a data URL (<code>data:image/svg+xml;base64,...</code>), this tool decodes it normally. The decoded SVG renders in the preview and downloads as a <code>.svg</code> file. Note that URL-encoded SVG (no Base64) uses a different format - <code>data:image/svg+xml;utf8,<svg...></code> - and this tool is Base64-only.
Why does my decoded JPEG look identical to the original?
Because Base64 is lossless. The encoding preserves every bit of the original file, so decoding gives back a byte-for-byte copy. No quality is lost in the round trip. If you compare the decoded output to the original JPEG with a hash function, they will match exactly.
More Image Tools
Favicon Generator
Generate favicons in all standard sizes (16x16 to 512x512) for websites and PWAs.
Open toolImage Blur & Pixelate
Apply blur or pixelation effects to images with adjustable intensity.
Open toolImage Color Picker
Upload an image and pick colors in HEX, RGB, and HSL with a visual color history.
Open toolImage Compressor
Compress images by adjusting quality to reduce file size without losing visual clarity.
Open toolImage Cropper
Crop images with preset aspect ratios like 1:1, 16:9, and 4:3 using a visual editor.
Open toolImage Flip & Rotate
Flip images horizontally or vertically and rotate by 90, 180, or 270 degrees.
Open tool