Loading Base64 to Image Converter...
How to Convert Base64 to an Image
Images turn up as Base64 all the time: an avatar field in a JSON API response, a logo inlined into an HTML email, a background in a CSS file, a screenshot stored in a database column. Usually you just want to see the picture, or save it as a normal file, without first working out which format it is. That is what this page does.
Paste the Base64 string
Paste the string into the input panel: a bare Base64 value from a JSON response, or a full data: URI copied from HTML or CSS. Line breaks, surrounding quotes and URL-safe characters (- and _) are fine. You can also upload a .txt file holding the string.
How the start of the string gives the format away
iVBORw0KGgo... # PNG /9j/4AAQSkZJRg...# JPEG R0lGODlh... # GIF UklGR... # WebP (RIFF) PHN2Zy... # SVG (<svg as text)
Check the format and preview
The string is decoded a moment after you paste. The Format line shows what the bytes really are, and the preview shows the picture when your browser can draw that format. A typo in the string is reported with its line and column.
Download the image
Click Download to save the decoded bytes with the extension of the detected format. On larger screens you can type a file name first; the extension is added for you.
Why images end up as Base64
Image files are binary, and plenty of places only carry text: JSON bodies, HTML attributes, CSS rules, environment variables, CSV exports. Base64 spells any bytes with 64 safe characters, at the cost of making the data about a third larger, so it is the usual way to squeeze a PNG, JPEG or WebP into one of those.
Decoding simply reverses that, giving back the original bytes. If you are reading a JSON response that holds images next to other fields, JSON to Table lays the rest of the data out so you can find the field you need.
Frequently Asked Questions
I don’t know what format my Base64 image is. Does that matter?
No. After decoding, the page looks at the first bytes of the file, where every image format leaves a fixed signature, and names the format it finds. The download gets the matching extension. You can often tell by eye too: PNG strings start with iVBOR, JPEG with /9j/, GIF with R0lGOD and WebP with UklGR.
Which formats does it recognise?
PNG, JPEG, GIF, WebP, BMP, TIFF, ICO and CUR icons, AVIF, HEIC and SVG. Chrome, Edge and Firefox can preview most of these. TIFF and HEIC usually have no preview in those browsers; the page says so, and the download is still the complete file.
The data URI says image/png, but the page says JPEG. Which is right?
The page is. The MIME type in a data: URI is just a label someone typed, and it is wrong more often than you would think, for example when a JPEG gets stored under a hard-coded data:image/png prefix. The page goes by what the bytes say, so the file you download opens in any viewer.
Does decoding change the image in any way?
No. Base64 is only a text wrapper around the original bytes, so decoding gives back exactly what was encoded: same resolution, same colours, same transparency, same metadata. Nothing is re-compressed or converted, which also means a WebP stays a WebP. To change the format you need an image editor.
What if the string is not an image at all?
You get an error that says what the data looks like instead, for example plain text, a PDF or a ZIP archive. For those, Base64 to File saves any kind of data with the right extension.
Is it safe to paste an SVG that someone sent me?
Yes. The preview loads the decoded file as an image, and browsers never run scripts inside an SVG shown that way. The SVG file you download is unchanged, though, so be careful if you later open it directly in a browser tab.
Is my image uploaded anywhere?
No. Decoding, the preview and the download all happen in your browser. Nothing is sent to our server and nothing is kept, so the editor is empty again after a reload. Very large strings are only limited by your browser’s memory.
Related pages: Base64 to File · Base64 to PNG · Base64 to JPG · Image to Base64
Related Tools
Image to Base64
Convert images to Base64 encoded strings for embedding in HTML, CSS, and APIs
PNG to Base64
Convert PNG images to Base64 encoded strings for embedding
Base64 to PNG
Decode Base64 strings to PNG images, see the picture and save the exact file
BMP to Base64
Convert BMP/Bitmap images to Base64 encoded strings
Base64 to BMP
Decode Base64 strings to BMP/Bitmap images
Base64 to WebP
Decode Base64 strings to WebP images with transparency