Base64 → PNG · JPEG · GIF · WebP · SVG
Base64 to image, previewed and ready to download.
Paste a Base64 image string or a full data:image/…;base64, URI. The picture appears in the Preview tab with its real pixel size, and Download saves it as a genuine image file with the right extension. Decoding happens in your browser, so the image is never uploaded.
Updated · Runs entirely in your browser
Base64 to image converter
JSON Web Token
Options
Ctrl+Enter decode Ctrl+Shift+C copy result Drop a file anywhere on the input to load it
How to convert Base64 to an image
- 01
Paste the Base64 image
Paste the data URI or just the encoded part into the input box. Line breaks, spaces and the data: prefix are removed automatically.
- 02
Check the preview
The image type is detected from its signature bytes and rendered in the Preview tab, together with its width, height and file size.
- 03
Download the image
Press Download to save the decoded bytes as a .png, .jpg, .gif, .webp or .svg file, ready to open in any image editor.
Data URI or raw Base64 — both work
Images embedded in HTML, CSS, JSON and email usually arrive as a data URI:
data:image/png;base64,iVBORw0KGgo…. Everything before the comma is a label; the image is the
Base64 after it. Paste either form here. When a prefix is present it is stripped, but the decoder still
checks the file signature itself, so an image mislabelled as image/png that is really a JPEG
is still identified and saved correctly.
To embed the decoded image somewhere else, you do not need to decode it at all: a data URI can be used
directly as an <img src> or a CSS url(). Decoding is for when you need
the file itself — to edit it, inspect it, or check what an API actually returned.
Recognise an image from its first few characters
Because Base64 maps the same bytes to the same characters, every file format has a recognisable opening. You can tell what a Base64 string contains before decoding it:
| Format | Base64 starts with | First bytes (hex) |
|---|---|---|
| PNG | iVBORw0KGgo | 89 50 4e 47 0d 0a 1a 0a |
| JPEG | /9j/ | ff d8 ff |
| GIF | R0lGOD | 47 49 46 38 (GIF8) |
| WebP | UklGR | 52 49 46 46 (RIFF) |
| SVG | PHN2Zy / PD94bWwg | <svg / <?xml |
| BMP | Qk | 42 4d (BM) |
| ICO | AAABAA | 00 00 01 00 |
A string that starts with /9j/ is a JPEG, iVBORw0KGgo is a PNG — useful
when a log line or a database column gives you nothing else to go on.
Why the preview stays blank
- The string is truncated. Long Base64 values are often cut off by log viewers, chat apps and spreadsheet cells (Excel stops at 32,767 characters). The header decodes but the image data is incomplete. Copy the value from the original source.
- It is not an image. Check the Type field under the output. If it says PDF, ZIP or Binary data, the Base64 holds a different kind of file — download it instead.
- The format is not displayable. Browsers cannot render HEIC or TIFF, so those files decode correctly but cannot be previewed. Download them and open them in an image viewer.
- It was encoded twice. If the output is more Base64 (often starting with
aVZCT1J3, which is “iVBORw” encoded again), press Send to input and decode a second time.
Convert Base64 to an image file in code
# Python
import base64
with open("image.png", "wb") as f:
f.write(base64.b64decode(b64_string))
// Node.js
fs.writeFileSync("image.png", Buffer.from(b64String, "base64"));
# Linux / macOS shell
base64 --decode image.b64 > image.png
Strip any data:image/…;base64, prefix before decoding in code — most decoders treat the
prefix as invalid input. More languages are covered in the
Base64 decode code snippets.
More decoders
Other ways to decode Base64.
- Base64 decode Decode any Base64 to text, an image or a file, with 20+ character sets.
- Base64 to PDF Turn a Base64 string from an API or email into a PDF you can view and save.
- Base64 to hex See every decoded byte as a hex dump, or copy it as one continuous hex string.
- Base64URL decode Decode URL-safe Base64 and JSON Web Tokens, with missing padding repaired.
Questions
Base64 to image: common questions.
How do I convert Base64 to an image?
Paste the Base64 string or data URI into the input box on this page. The image is decoded in your browser and shown in the Preview tab. Press Download to save it as a PNG, JPEG, GIF, WebP or SVG file with the correct extension.
Do I need to remove the data:image/png;base64, prefix?
Not here. The prefix is detected and removed automatically, and the actual image type is confirmed from the decoded bytes. In code you usually do need to strip everything up to and including the comma before decoding.
Which image formats can be decoded from Base64?
Any format, because Base64 just carries bytes. PNG, JPEG, GIF, WebP, BMP, ICO, AVIF and SVG can be previewed in the browser. Formats browsers cannot display, such as HEIC and TIFF, still decode correctly and can be downloaded.
Is my image uploaded anywhere?
No. The Base64 is decoded by JavaScript running on this page and the preview is created from a local blob URL. Nothing is sent to a server, so it is safe for screenshots, scans and other private images.