File & Format Converters · Free tool
Base64 to Image
Paste a Base64 string or data URL and preview it as an image. Download the decoded PNG or JPG instantly.
Advertisement
What it does
Paste any base64-encoded image string — with or without the data:image/...;base64, prefix — and the tool decodes it, shows you a live preview of what the image actually contains, and lets you download it as a file. The reverse of the image-to-base64 tool: useful when you've got a base64 blob from an API response, an email attachment header, a CSS file, an HTML data URL, or a JSON payload, and you need the actual image to inspect, edit, or save.
The decoder accepts every common form of input:
- Full data URL:
data:image/png;base64,iVBORw0KGgo… - Bare base64 (no prefix):
iVBORw0KGgo… - Multi-line base64 (with newlines, common in MIME-encoded email): handled transparently
- URL-safe base64 (
-and_instead of+and/): auto-converted
MIME type is auto-detected from the magic bytes of the decoded data — so even if your input lacks the data-URL prefix, the tool figures out whether it's PNG, JPEG, GIF, WebP, BMP, SVG, or PDF and offers the right download extension. Works entirely in your browser; no upload, no server.
Embed this tool on your siteShow snippetHide
Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.
<iframe src="https://freetoolarena.com/embed/base64-to-image" width="100%" height="720" frameborder="0" loading="lazy" title="Base64 to Image" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>How to use it
- Paste your base64 string into the input box. Any common form works — full data URL, bare base64, multi-line, URL-safe.
- The image preview renders immediately if the data is valid. The detected MIME type appears below the preview.
- Click Download. The file downloads with the correct extension matching the detected format (.png, .jpg, .gif, etc.).
- If the preview is blank, the input isn't valid base64 image data — check for stray quotes, backslashes, or HTML escapes that might be corrupting the string.
- For huge base64 (>1 MB encoded), the preview may take a second to render — the browser is decoding several megabytes of data.
When to use this tool
- Inspecting an image embedded in an API response or webhook payload.
- Extracting an image from an email's MIME-encoded attachment when you only have the raw text.
- Decoding a data URL you've copied from a CSS file or inline HTML.
- Verifying that a base64 blob actually contains the image you expected — quick visual sanity check.
When not to use it
- Non-image base64 (PDF, audio, ZIP) — the preview shows blank for those because the canvas can't render them. Use a generic base64-decoder for arbitrary file types.
- Encrypted or scrambled data that just happens to be base64-encoded — decoding base64 is not decryption. You need the encryption key, which is a separate step.
- Base64 that's been further encoded (e.g. URL-percent-encoded) — strip outer encoding layers first.
Common use cases
- Educational use — demonstrating the underlying concept
- Onboarding a colleague who needs the same calculation/conversion
- Verifying a number or output before passing it on
- Quick conversion during a typical workday
Frequently asked questions
- What's the difference between base64 and data URL?
- Base64 is the encoding (binary → ASCII text). A data URL is a complete URL using base64 as its data scheme: `data:image/png;base64,<base64>`. The prefix tells browsers what to do with the bytes; the bare base64 is just the encoded payload. The tool accepts both forms and adds/strips the prefix as needed.
- What's URL-safe base64?
- Standard base64 uses `+` and `/` characters, which are unsafe in URLs (they have special meanings) and in filenames. URL-safe base64 substitutes `-` for `+` and `_` for `/`. Some APIs use URL-safe by default. The tool auto-detects and converts.
- Can I decode multi-line base64 from emails?
- Yes. MIME-encoded email attachments wrap base64 at 76 characters per line. The tool strips the line breaks transparently — paste the whole multi-line block and it decodes fine.
- How does it know what format the image is?
- By inspecting the first few bytes of the decoded data — every image format has a unique 'magic number' at byte 0. PNG starts with 0x89 0x50 0x4E 0x47, JPEG with 0xFF 0xD8 0xFF, GIF with 0x47 0x49 0x46 0x38, etc. The tool reads those and labels the format accordingly.
- What's the max base64 size I can paste?
- Limited by your browser's clipboard and memory — practical limit is a few megabytes of encoded data (~3-4 MB image after decoding). Paste larger and the browser may freeze for a few seconds during decode.
- Is the data uploaded anywhere?
- No. Decoding happens in your browser via atob() and an Image element. Open DevTools → Network during use and you'll see zero outbound requests. The image stays on your device.
Advertisement
Learn more
Guides about this topic
- Using Our Tools · GuideHow to merge PDFsMerge PDFs free and safely directly in your browser—no watermarks, sign-up, or uploads. Combine documents instantly with our online tool, no download required.
- Using Our Tools · GuideHow to split a PDFSplit a PDF by pages or ranges without uploading to a server. Clear steps, common pitfalls, and a free tool you can use instantly in your browser.
- Design & Media · GuideHow to compress images without losing qualityCompress images without losing quality — pick the right format, dimensions, and quality settings to shrink files fast. Free online guide, no signup.
- Design & Media · GuideHow to resize images without losing qualityResize images without quality loss — Lanczos vs bicubic, downscale tips, AI upscaling limits, web/print sizes, batch tools. Free guide, no sign-up.
- Design & Media · GuideHow to choose image formatsAnalyze JPG, PNG, WebP, AVIF, and SVG trade-offs with our free, browser-only guide. Instant format recommendations for quality, size, and compatibility.
- Design & Media · GuideHow to convert color formatsConvert colors instantly between HEX, RGB, HSL, OKLCH, and CMYK. Free online mapping for digital and print projects with no sign-up required.
Explore more file & format converters tools
- HEIC to PDFCombine iPhone HEIC photos into a single multi-page PDF. Reorder pages, pick A4/Letter or fit-to-image. Browser-only, no uploads, no watermarks.
- HEIC to WebPConvert iPhone HEIC photos to WebP — 25-35% smaller than JPG at the same quality. Universal modern-browser support. Batch in-browser, no uploads.
- HEIC to PNGConvert iPhone HEIC photos to lossless PNG right in your browser. Pixel-perfect output for editing pipelines and archival. Batch supported, no uploads.
- Timestamp ConverterTransform Unix timestamps to ISO 8601 dates and back instantly. Auto-detects milliseconds vs seconds for precise conversion with no sign-up.
- Text to Binary ConverterConvert any text to/from binary using UTF-8 codepoints. Multi-byte chars (emoji, non-Latin) handled correctly.
- Binary ConverterEdit any field to instantly transform numbers across all four bases in your browser. Use this free, ad-free live conversion tool with no sign-up.