Base64 file converter
Convert a string, file, or image into its base64 representation.
About Base64 file converter
Encodes any file (image, PDF, font, archive) into a Base64 string, and turns a Base64 string back into a downloadable file, detecting the type from the data when possible. Everything happens in your browser.
When you would use it
- Embedding a small image or font directly in HTML, CSS or JSON as a data URL.
- Sending a binary file through a text-only channel such as a JSON API, an e-mail body or a configuration file.
- Saving a Base64 payload received from an API as a real file to open it.
How to use it
- To encode, drop a file onto the upload area and copy the Base64 output.
- To decode, paste a Base64 string (with or without the data: prefix), set a file name and extension if the type is not detected, and press download.
- Use the preview to confirm an image decoded correctly.
Things worth knowing
- Base64 makes data about 33% larger. Embedding is sensible for files under a few kilobytes (icons, small fonts); larger assets are better served as separate files that the browser can cache.
- A data URL needs the MIME type in front (data:image/png;base64,...). The encoder output here is the raw Base64 body; prepend the type yourself when building a data URL, or copy it from the image preview.
- The file type is guessed from the first bytes of the decoded data. For formats without a recognisable header (plain text, CSV, some binaries) set the extension manually.
- Large files are encoded in memory, so files of several hundred megabytes may be slow or fail depending on the device.
Frequently asked questions
- Why is the decoded file damaged or will not open?
- Usually the Base64 string was truncated, had line breaks or spaces inserted by an e-mail client, or was URL-safe Base64 (with - and _). Clean the string and make sure its length is a multiple of 4 (padding with =).
- Is Base64 a way to hide or protect a file?
- No. It is an encoding anyone can reverse instantly. Use encryption if confidentiality matters.