🔓

Base64 to Image

✓ Free & no signup 🔒 Runs 100% in your browser Updated 2026-11-25 Images Editing Tools

Base64 strings show up everywhere once you start working with web data: API responses carrying inline thumbnails, CSS files with embedded icons, database rows storing profile pictures, email templates with encoded logos. The string itself is unreadable, and the only way to check what it actually contains is to decode it. This tool does exactly that. Paste a data URI or raw Base64, see the decoded image immediately, and download it as a file if it is what you expected.

Decoding runs entirely in your browser. The string is parsed locally, converted back into binary bytes, and rendered on a canvas. Nothing is sent anywhere, there is no signup, and it works on phones as well as laptops. That matters when the string came from a production API or contains a private screenshot: it never leaves your device.

The tool is deliberately forgiving about input. You can paste a complete data URI with the data:image/png;base64, prefix, a bare Base64 payload with no prefix, or a URL-safe Base64 variant that uses - and _ instead of + and /. Padding characters at the end are optional. Any of these forms decodes correctly, which saves you from the usual pre-cleaning ritual before every decode.

What Base64 Decoding Actually Does

Base64 is a reversible encoding, not compression. Every 4 characters of input map back to exactly 3 bytes of binary data: each character represents 6 bits, four of them yield 24 bits, and those 24 bits split into three 8-bit bytes. Reversing the encoding simply walks that mapping backwards and reassembles the binary stream, which the browser then interprets as an image file.

Padding explains the = signs you sometimes see at the end. If the original binary data was not a multiple of 3 bytes long, the encoder adds one or two = characters so the encoded length is a multiple of 4. One = means the last group carried 2 bytes; two = signs mean it carried 1 byte. A 4,500-byte PNG encodes cleanly with no padding since 4,500 divides evenly by 3, while a 4,501-byte file needs one = and a 4,502-byte file needs two.

Input forms this tool accepts

Input styleExampleStatus
Full data URIdata:image/webp;base64,UklGRh4A...Accepted as-is
Bare Base64iVBORw0KGgoAAAANS...Accepted, type inferred
URL-safe Base64AbC-_43= with - and _ charactersAccepted, converted internally
Missing paddingPayload ending without =Accepted, padding reconstructed

How to Decode Base64 to an Image (Step by Step)

  1. Copy the Base64 string or data URI from wherever it lives: an API response, a CSS file, a database field, or a JSON document.
  2. Paste it into the input area. Whitespace and line breaks are tolerated and stripped automatically, so copied-and-wrapped strings work fine.
  3. Review the preview. The tool detects the image type from the decoded header bytes and renders the image with its pixel dimensions.
  4. If the preview looks right, download the decoded file. It is saved with the correct extension, such as .png or .jpg, based on the detected type.
  5. If the preview looks wrong, the string is probably truncated or corrupted. Compare the start and end of the source string against what you pasted.

Key Features

  • Flexible input: full data URIs, bare Base64, URL-safe variants, and missing padding all decode without manual cleanup.
  • Instant preview: you see the image and its dimensions before deciding to download, so bad strings never produce mystery files.
  • Type detection: the tool reads the magic bytes of the decoded binary, recognizing PNG, JPEG, GIF, WebP, and other common formats rather than trusting a possibly wrong prefix.
  • Local decoding: everything happens in browser memory; strings from private APIs or confidential documents stay on your machine.
  • Free and unlimited: no account, no watermark, mobile-friendly.

Common Use Cases

  • Checking what image an API actually returned before wiring it into a frontend, instead of debugging blind in the browser console.
  • Recovering an image file from a JSON payload or log entry so it can be viewed, archived, or attached to a bug report.
  • Extracting the embedded icons from a stylesheet full of data URIs during a redesign or asset audit.
  • Decoding a screenshot that arrived in a chat webhook or monitoring alert as an encoded string.
  • Verifying that a Base64-encoded upload was stored correctly in a database by decoding a sample row.
  • Inspecting suspicious data URIs safely: decoding happens locally, so nothing is fetched from an external server.

Why Decode in the Browser Instead of the Console?

Developers often decode Base64 with atob in the browser console or a command-line utility. Those work, but they stop at raw bytes: you still have to wrap the output in a Blob, build an object URL, and open it manually. This tool collapses that into paste, look, download. It also handles the inputs that trip up quick scripts: URL-safe alphabets, stripped padding, wrapped lines, and wrong MIME prefixes, each of which makes naive decoders fail or produce a broken image.

A concrete failure case: a string copied from a document loses its last 40 characters to a copy-range mistake. atob happily decodes the partial data, and you get an image file that most viewers refuse to open, with no explanation. Here, the preview simply stays blank or shows a partial render, telling you immediately that the source string is incomplete rather than sending you hunting through viewers and codecs.

Recognizing Image Types from the First Bytes

Decoded binary starts with a signature that identifies the format, and the tool uses these rather than the declared MIME type. PNG begins with the 8-byte sequence 89 50 4E 47 0D 0A 1A 0A. JPEG begins with FF D8 FF. GIF begins with either GIF87a or GIF89a in plain ASCII. WebP begins with RIFF followed by WEBP at offset 8. When the payload's signature and its data URI prefix disagree, the signature wins, because prefixes are hand-written far more often than they are wrong in the actual bytes.

Size math is worth internalizing too: a Base64 string of length 8,000 characters decodes to about 6,000 bytes, since every 4 characters yield 3 bytes. If you know an image should be around 50 KB and the string is only 800 characters long, you are looking at a fragment, not the whole image.

Tips and Best Practices

  • Check the string length before blaming the decoder. A 100-character fragment is not an image, no matter how correct the decoding is.
  • Trust the preview over the prefix. A string labeled image/jpeg that decodes to PNG bytes was mislabeled somewhere upstream.
  • Strip nothing manually. Extra quotes, escaped characters from JSON, and line wrapping are all handled, though a leading data: prefix with stray HTML entities can still break decoding at the source.
  • For very large payloads, above roughly 10 MB of text, desktop browsers handle it comfortably; older mobile browsers may slow down on the paste event.
  • When recovering many images from a bulk export, decode one first to confirm the format and padding convention, then batch the rest with confidence.

Base64-to-Image vs. Related Conversions

This tool is the reverse of image-to-Base64 encoding: that direction takes a file and produces a string for embedding, this one takes a string and recovers the file. They are commonly used together in a round trip, encoding an image into a config or API payload, transporting it, then decoding it on the other side to verify the bytes survived intact. Because Base64 is lossless, a round trip through this tool returns pixel-identical data to the original file, unlike lossy format conversions where each pass degrades the image.

Frequently Asked Questions

How do I convert Base64 back to an image?
Paste the Base64 string or full data URI into this tool. It decodes the text back into binary bytes in your browser, detects the image type from the file signature, and shows a preview. If the image looks correct, click download to save it as a normal file. Everything happens locally, so nothing is uploaded to a server.
Why does my Base64 string end with = signs?
Padding characters make the encoded length a multiple of 4. One = means the final group carried 2 bytes of original data, two = signs mean it carried 1 byte. Strings whose source data divides evenly by 3 bytes have no padding at all. This tool accepts input with or without padding and reconstructs it automatically.
What is URL-safe Base64 and can this tool decode it?
URL-safe Base64 replaces the + character with - and the / character with _ so the string survives inside URLs and query parameters without escaping. The binary data is identical to standard Base64. This tool detects and converts the alphabet internally, so both standard and URL-safe variants decode correctly.
Why is my decoded Base64 image not displaying?
The most common cause is a truncated string: if characters were lost during copying, the decoded bytes are incomplete and no viewer can render them. Compare the start and end of the source string with what you pasted. Other causes are stray quotes or HTML entities around the string, or a MIME prefix that does not match the actual payload.
How long should a Base64 string be for an image?
Base64 is about 33 percent larger than the binary file, so divide the string length by 1.33 to estimate the image size. A 100 KB PNG needs roughly 133,000 characters. If you expect a 50 KB image but the string is only a few hundred characters long, you have a fragment rather than the complete file.
Can I decode a Base64 image on my phone?
Yes. The decoding runs entirely in the mobile browser using standard JavaScript APIs, so it works on Android and iOS without installing anything. Paste the string, view the preview, and download the image to your device. Large strings above several megabytes are best handled on desktop, where older mobile browsers can slow down.

Related Tools