How-to guide
How to Convert Base64 to Image Online Free — Steps
To convert Base64 to an image, paste the Base64 string — or the full data URI that starts with data:image/...;base64, — into a decoder, preview the picture, and download it as a file with the extension that matches its real format (.png, .jpg, .gif, .webp, or .svg). The decoded bytes are identical to the original image; only the representation changes, from text back to a picture. Use the free Base64 to Image tool, which previews a Base64 data URL and downloads it as an image file, or decode in code for a batch.
At a glance
| Item | Detail |
|---|---|
| Input | Base64 text, or a full data:image/...;base64,... data URI |
| Output | The original image file (PNG, JPEG, GIF, WebP, SVG, and more) |
| Size change | Base64 text is about 33% larger than the image it holds |
| Removed | The data: prefix and = padding are consumed by decoding |
| Tool | Base64 to Image on Hellagape |
What Base64 and a data URI are
Base64 is a way of writing binary data using only 64 safe text characters: the letters A–Z and a–z, the digits 0–9, plus + and /, with = used as end padding. Every 3 bytes of the original file become 4 characters, each carrying 6 bits of data, which lets raw image bytes travel safely inside HTML, CSS, JSON, XML, or an email body. A data URI wraps that text with metadata — data:image/png;base64, followed by the Base64 itself — so a browser knows what kind of file the text represents.
Conversion back is needed because images arrive as text all the time: inline images in CSS and HTML, icons in JSON configuration, pictures returned by APIs, and exports from databases and design tools. To view, edit, or re-upload any of them, you need the actual picture file back.
Which format is it? Read the first characters
Every image format starts with fixed signature bytes, which encode to recognisable Base64 prefixes. The first characters of the payload (after the comma, if there is a prefix) tell you the true format, whatever the prefix claims:
| Format | Data-URI prefix | Base64 starts with |
|---|---|---|
| PNG | data:image/png;base64, | iVBORw0KGgo |
| JPEG | data:image/jpeg;base64, | /9j/ |
| GIF | data:image/gif;base64, | R0lGOD |
| WebP | data:image/webp;base64, | UklGR |
| SVG | data:image/svg+xml;base64, | PHN2Z or PD94bWwg |
| ICO (favicon) | data:image/x-icon;base64, | AAABAA |
If a string claims to be image/png but begins with /9j/, it is really a JPEG — save it with a .jpg extension. The same trick works in reverse when you are hunting through a stylesheet or an API response: scan for iVBORw0KGgo and you have found every inlined PNG in the file.
How to convert Base64 to an image with the Hellagape tool
The Base64 to Image tool previews a Base64 data URL and downloads it as an image file, processing everything in your browser with the Canvas API — nothing is uploaded, and there are no watermarks or daily limits. Follow the labels on the page itself for the exact controls; the conversion is these five steps:
- Open the Base64 to Image tool and provide your Base64 string or full data URI.
- Preview the decoded image and confirm it is the picture you expected.
- Download the previewed image as a file, keeping the extension that matches its real format.
- Open the downloaded file in an image viewer and check it renders at the right size.
- Keep the original Base64 string if you may need to embed the image again.
Very large images depend on your device's memory, because the pixels never leave your device. For a batch of strings, decode in code instead (see below).
How to convert Base64 to an image in code
For repeated work, every mainstream environment ships a one-liner. Except for the browser's fetch(), each of these expects only the payload after the comma — split on the first comma first, and always write the output in binary mode:
- Browser JavaScript:
fetch(dataURI).then(r => r.blob())accepts a full data URI directly. - Node.js:
fs.writeFileSync('img.png', Buffer.from(s, 'base64')) - Python:
open('img.png','wb').write(base64.b64decode(s))— note the binary'wb'mode. - Linux / macOS shell:
base64 -d encoded.txt > img.png(older macOS uses-Dinstead of-d). - PowerShell:
[IO.File]::WriteAllBytes('img.png', [Convert]::FromBase64String($s))— strict about padding; the length must be a multiple of 4.
Worked example: a 1×1 PNG, counted byte by byte
This is the smallest useful test: a 1×1 transparent PNG as a data URI. Paste it into the tool and you should see a single transparent pixel, downloadable as a .png file.
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=
- The payload after the comma is 92 Base64 characters long and starts with
iVBORw0KGgo— the PNG signature from the table above. - Decoded, those 92 characters become exactly 68 bytes of PNG file. The ratio 92 ÷ 68 ≈ 1.35 is the Base64 overhead at this tiny size; as files grow it settles toward the theoretical 4/3 ≈ 1.33, because every 3 bytes become 4 characters.
- The grouping in miniature: the 3 bytes of the text
Manencode to the 4 charactersTWFu. An image is the same trick repeated — 3 bytes at a time, with=padding filling the final group when the byte count is not a multiple of 3.
Verified programmatically: the string above decodes to 68 bytes, and Man encodes to TWFu.
Tips and common mistakes
- Truncated strings. The most common failure. Consoles, log viewers, and chat apps routinely clip long values. A valid payload has a length that is a multiple of 4 (counting the
=padding); if yours ends mid-word, go back and copy the full value from the source — the CSS file, HTML attribute, or API response, not a DevTools inspector. - Feeding the whole data URI to a code decoder. The
data:image/png;base64,prefix contains characters outside the Base64 alphabet, soatob()and Python reject it. Split on the first comma and decode only the payload. - URL damage. Form and query-string encoding turns
+into a space and percent-encodes/and=. If you see spaces or%sequences inside the payload, URL-decode it first. - URL-safe alphabet. Some APIs swap
+for-and/for_. Convert-back to+and_back to/before decoding in a browser. - Wrapper characters. Copying out of CSS brings
url("…")and quotes with it; copying out of JSON brings the surrounding"marks. Strip everything so the paste starts withdata:or with the Base64 itself. - Writing text mode. Saving decoded bytes as text corrupts them on Windows. Always write binary.
- It isn't an image. Base64 encodes any binary, so the string may be a PDF (
JVBERi0) or a ZIP (UEsDB). Check the opening characters against the signature table; if they match no image format, no image converter will render it.
FAQ
How do I convert Base64 to an image?
Paste the Base64 string or data URI into a decoder such as the Base64 to Image tool. The image is decoded and previewed in your browser, and the download saves it as a file with the extension matching its real format. No upload or sign-up is needed.
Do I need the data:image prefix, or is raw Base64 enough?
Raw Base64 is enough. Browsers identify images by their actual leading bytes rather than the declared type, so a JPEG, GIF, or WebP payload pasted without a prefix still decodes correctly. If you do have the full data URI, paste the whole thing — the prefix is consumed by decoding.
What image formats can Base64 decode to?
Anything your browser can display: PNG, JPEG, GIF, WebP, SVG, and, in current browsers, AVIF. The first characters of the payload identify the format — iVBORw0KGgo is PNG, /9j/ is JPEG, R0lGOD is GIF, and UklGR is a RIFF file such as WebP.
Why does my Base64 string fail to decode?
Nine times out of ten the string is incomplete — image Base64 is long, and whatever you copied it from clipped the end. Otherwise check for URL-encoding damage (spaces where + should be, %2F sequences), the URL-safe alphabet (- and _ instead of + and /), or wrapper characters copied from CSS or JSON.
Is converting Base64 to an image private?
With a browser-based tool, yes: decoding runs in JavaScript on your device, and the string and the resulting image are never transmitted. That matters when the payload came from a customer database, an internal API, or anything else you are not free to paste into an uploading service. The Hellagape tool processes everything locally and uploads nothing.
How much bigger is Base64 than the original image?
About 33% larger, because every 3 bytes become 4 characters. A 90 KB photo becomes roughly 120 KB of text. At very small sizes the ratio is slightly higher — the 68-byte PNG in the worked example above needs 92 characters, a ratio of about 1.35.
Is Base64 encryption? Is a decoded image safe?
No — Base64 is an encoding, not encryption. There is no key, and anyone can reverse it instantly, so never rely on it to protect a sensitive image. Decoding itself is inert, but treat decoded files from untrusted sources like unknown attachments; SVG deserves extra care because it is XML that can contain scripts, so check a decoded SVG for <script> before inlining it into a page.
Can I convert Base64 to an image for free without installing software?
Yes. Use the Base64 to Image tool for one-off strings, or the code one-liners above for batches. Both paths are free, and the browser path installs nothing.
Related tools
- Base64 to Image — preview a Base64 data URL and download it as an image file.
- Image to Base64 — the reverse direction: turn an image file into a Base64 string.
- Base64 Decoder — decode Base64 strings back to readable UTF-8 text or binary data.
- Converters — browse Hellagape converters.
Try it now
Base64 to Image
Preview a Base64 data URL and download it as an image file.
Keep reading