Encode text to standard or URL-safe Base64, or decode Base64 back to UTF-8 text.
Base64 File Converter
Use Base64 File Converter
What it does
Drop or choose a file to get it as a Base64 data URI, or paste a data URI to decode it back into a downloadable file.
It runs entirely in your browser: nothing you enter is uploaded.
How to use Base64 File Converter
- Choose or drop a file. Click the dashed box to pick a file, or drag one onto it. If you drop several files, only the first one is converted.
- Read the data URI. The box below fills with data:type;base64, followed by the encoded file. The line under it shows the original size, the Base64 size and the overhead.
- Copy the result. Press Copy to put the whole data URI on your clipboard, for example to paste it into a test page or a case note.
- Paste a data URI to decode. To go the other way, paste a data URI into the lower box, such as data:image/png;base64,... Parameters like ;charset=utf-8, line breaks, URL-safe Base64 and percent-encoded data URIs are accepted.
- Download and check the file. Press Decode & Download to save the file. If it came from a suspicious email or page, check it with File Type Sniffer and File Hash before you open it.
Example
A small image
A small PNG file, dropped onto the box or chosen by clicking itdata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
Original: 70 bytes | Base64: 96 bytes (37% overhead) | Data URI: 118 bytesThe box below fills with data:image/png;base64,... and a line shows the original size, the Base64 size with the overhead and the length of the whole data URI: Base64 is about a third larger than the file.
What it checks
| Signal | What it means |
|---|---|
| MIME type after data: | This is the type your browser reports for the file, which usually comes from the file name extension. It does not prove what the file really contains, so a renamed file keeps a misleading type. |
| Original size | The file size in KB with one decimal. Files smaller than about 50 bytes show 0.0 KB, which is rounding, not an empty file. |
| Base64 size and overhead | The length of the Base64 part, without the data:type;base64, prefix, and how much larger it is than the file. Large files settle near 33 percent; tiny files show more because of padding. |
| Decoded file name | The download is named decoded. plus an extension from the MIME type, such as decoded.png, decoded.txt for text/plain or decoded.bin when no type is given. A line under the button names the file, its size and type. |
| Message under the button | A data URI that cannot be read, or Base64 with characters outside A–Z, a–z, 0–9, + and /, gives a message under the button instead of a download. |
| Data that stays local | Encoding uses the browser FileReader and decoding builds the file in memory, so the file and the pasted text are not sent anywhere by this tool. |
More examples
RFC 4648 test text
A text file foobar.txt that contains only the six letters foobar, with no line breakdata:text/plain;base64,Zm9vYmFy and the line Original: 0.0 KB | Base64: 0.0 KB (33% overhead). Zm9vYmFy is the published RFC 4648 test vector for foobar.
Decode a short text
data:text/plain;base64,Zm9vYg==Decode & Download saves a 4-byte file named decoded.txt that contains the text foob, and the line under the button names the file, its size and the type text/plain.
SVG image with an unusual extension
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4=The browser saves an empty 41-byte SVG image named decoded.svg+xml. Rename it to .svg if you want to look at it.
FAQ
What does it produce?
A data URI of the form data:type;base64,data, using the MIME type your browser reports for the file (application/octet-stream if it reports none). Base64 makes the data about a third larger, and it is an encoding anyone can reverse, not encryption.
Which data URIs can Decode & Download read?
Base64 data URIs such as data:image/png;base64,... or data:text/plain;charset=utf-8;base64,..., also with line breaks or URL-safe characters, and percent-encoded ones without ;base64; anything else gets a message under the button. Files decoded from phishing attachments can be harmful, so check them with File Type Sniffer before opening.
Is the file uploaded?
No. The file is read with the FileReader API and the data URI is built on this page; nothing is uploaded. Files up to 50 MB are converted, because a larger data URI could freeze the tab.
Why does a phishing email or page contain a long data:... string?
HTML attachments and phishing pages often embed logos, fonts, scripts or whole files as Base64 data URIs. The content then travels inside the page instead of being loaded from a separate address. Decoding the string here shows you what is hidden in it without opening the original page.
Can I decode plain Base64 that has no data: prefix?
Yes, if you add one. Put data:application/octet-stream;base64, in front of the string and press Decode & Download; you get a file named decoded.bin. For short text, Base64 Encoder/Decoder is quicker.
Why is the overhead above 33 percent for small files?
Base64 turns every 3 bytes into 4 characters and pads the last group with = signs. On a file of a few bytes that padding is a large share, so a 1-byte file shows 300 percent. From a few kilobytes on, the figure stays close to 33 percent.
Is it safe to open an SVG or HTML file decoded from a suspicious message?
Not in your normal browser. SVG and HTML files can contain scripts and links that run when opened. Look at the file type and hash first, and open such files only in a sandbox or a separate analysis machine.