Base64 to File Converter
Convert a Base64 string to a downloadable file.
Your data is never sent to any server.
The Base64 to file tool rebuilds the original file from a Base64 string or a data URI and lets you download it. Use it to pull out an image embedded in HTML, save an attachment that reached you encoded inside JSON, or find out what is inside a long string that cannot be read as text.
The most common signatures
Every format starts with a few fixed bytes, and in Base64 those bytes always turn into the same characters. With this table you can tell what you have even if the string has no prefix:
| Starts with | Format | Extension |
|---|---|---|
iVBORw0KGgo | PNG image | .png |
/9j/ | JPG image | .jpg |
R0lGOD | GIF image | .gif |
UklGR | WebP, WAV or AVI | .webp, .wav |
JVBERi0 | PDF document | |
UEsDB | ZIP, DOCX, XLSX | .zip, .docx |
From a src attribute to a file
If you copy a data URI from a web page, take everything from data: to the end of
the string, without the quotes around it in the code. With the prefix included,
the tool knows the file type and gives it the right extension without you having
to think about it.
How to use Base64 to File
- 1
Paste the Base64 string or data URI
The plain string works, and so does the version with its data: prefix, which is how it usually appears in HTML, CSS or JSON. Spaces and line breaks are ignored.
- 2
Check the file name
If you paste a data URI, the tool reads the file type from the prefix and adds the extension to the name. A plain string gives no clue, so type the extension yourself.
- 3
Download the file
Press Download file and it is saved with the name you chose.
Frequently asked questions
How do I know the file type if there is no prefix?
From the start of the string, which almost always gives the format away: iVBORw0KGgo is a PNG, /9j/ a JPG, JVBERi0 a PDF, R0lGOD a GIF and UEsDB a ZIP or an Office document. Put that extension in the file name before downloading.
What happens if I download the file without an extension?
The content is correct, but your system will not know which program to open it with. Just rename it afterwards and add the right extension.
It says the Base64 is not valid. Why?
Because there are characters outside the Base64 alphabet. Usually it is a bit of code picked up while copying, such as the quotes around the src attribute, or the Base64 URL variant, which uses - and _ instead of + and /.
Is the file sent to any server?
No. The string is decoded in your browser and the file is created on your device.