Paste a Base64 string or a full data URI and see the image right away. The tool detects the real file type from its bytes, shows the size and dimensions, and lets you download it with the right extension.
0 characters
Preview
Your image will appear here
Format
-
Dimensions
-
File size
-
MIME type
-
Advertisement
Advertisement
How to use the Base64 to Image
Paste your Base64 into the box. A full data URI (data:image/png;base64,…), raw Base64, or even a whole <img> tag or CSS url() works.
Check the preview. The detected type, dimensions and size appear next to it, with a warning if something looks wrong.
Change the background to checkerboard, white or dark to inspect transparent images.
Download the image in its original format, or click Download as PNG to convert it.
Copy the data URI if you need a clean, normalized version of the string.
Recognizing image types in Base64
Every file format starts with a fixed signature ("magic bytes"). Because Base64 encodes 3 bytes into 4 characters, the same signature always produces the same first characters, so you can often tell the format at a glance. This tool checks the decoded bytes, which is more reliable than trusting the data: prefix.
Format
First bytes (hex)
Base64 starts with
MIME type
PNG
89 50 4E 47 0D 0A 1A 0A
iVBORw0KGgo
image/png
JPEG
FF D8 FF
/9j/
image/jpeg
GIF
47 49 46 38 ("GIF8")
R0lGOD
image/gif
WebP
52 49 46 46 … 57 45 42 50 ("RIFF…WEBP")
UklGR
image/webp
SVG
text starting with <svg or <?xml
PHN2Zy or PD94bWw
image/svg+xml
BMP
42 4D ("BM")
Qk
image/bmp
ICO
00 00 01 00
AAABAA
image/x-icon
AVIF / HEIC
… 66 74 79 70 ("ftyp") at byte 4
usually AAAA
image/avif, image/heic
PDF (not an image)
25 50 44 46 2D ("%PDF-")
JVBERi0
application/pdf
Fixing a Base64 string that will not decode
Remove wrappers. Quotes, url(…), src="…" and JSON escapes such as \n or \/ are not part of Base64. This tool strips them automatically.
Check the length. Valid Base64 has a length that is a multiple of 4 once padding is added. A remainder of 1 means characters are missing, usually because the string was cut off when copying from a log or a database column with a size limit.
Look for double encoding. If the decoded data is itself Base64 text (for example it starts with ZGF0YTpp, which is "data:i" encoded again), it was encoded twice. The tool detects this and decodes both layers.
URL-safe strings from JWTs or URLs use - and _ instead of + and /, and often drop the = padding. Both are converted for you.
Frequently asked questions
How do I convert Base64 to an image?
Paste the Base64 text into the box. The tool decodes it to bytes in your browser, identifies the image format from the first bytes of the file and shows it. Click Download to save it as a .png, .jpg, .gif, .webp or .svg file.
Do I need the data:image/png;base64, prefix?
No. Raw Base64 works too: the tool reads the file signature to work out the format. If you paste a data URI, the prefix is checked against the actual data and you are warned if they disagree.
Why does my Base64 string not show an image?
Common causes are a truncated string (copied only part of it), extra characters such as quotes or escaped \n sequences, a string that encodes something other than an image (for example a PDF or text), or data that was encoded twice. The tool tells you which of these it detects.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / so it can appear in URLs, often without = padding. This tool accepts both alphabets and adds missing padding automatically.
Is it safe to paste private images here?
Yes. The string is decoded locally with JavaScript and is never sent to a server. SVG images are shown inside an img element, which does not run scripts.
How can I tell what file type Base64 contains?
Every file format starts with a signature. In Base64, PNG begins with iVBORw0KGgo, JPEG with /9j/, GIF with R0lGOD, WebP with UklGR and PDF with JVBERi0. The tool checks the decoded bytes for these signatures.