Base64 File Converter

Encode any file or image to a Base64 data URI and decode a data URI back into a downloadable file.

Loading tool…

Base64 File ConverterTurn any file or image into a Base64 data URI you can paste straight into CSS or HTML, then decode a data URI back into the original file with one download click. Everything runs 100% in your browser using FileReader and atob, so the file you drop never leaves your device and is never uploaded to a server.

What is Base64 File Converter?

The Base64 File Converter is a free, in-browser tool that converts between binary files and Base64 data URIs. Web developers use it to inline small images, fonts, or icons directly into stylesheets and markup, removing an extra network request; QA engineers and support staff use the decode side to recover a file that was pasted to them as a long data URI. Use Encode to drop a file and copy its data URI (optionally pre-wrapped as a CSS background-image rule or an HTML img tag), and use Decode to paste a data URI and download the reconstructed file. Image inputs and decoded images show a preview you can click to enlarge.

How to use Base64 File Converter

  1. Pick a mode with the Encode / Decode toggle at the top.
  2. To encode, drop or choose a file (or image) in the upload area; its Base64 data URI appears instantly in the output box.
  3. Open Settings to choose the output wrapper: a raw data URI, a CSS background-image rule, or an HTML img tag.
  4. Press the Copy button to put the data URI on your clipboard.
  5. To decode, switch to Decode and paste a data URI into the text area; a preview and file details appear.
  6. Click the Download button to save the reconstructed file to your device.

Examples

Inline a small PNG icon in CSS

Encode mode: drop a 2 KB icon.png, set the wrapper to CSS, then copy the background-image: url("data:image/png;base64,…") rule straight into your stylesheet.

Recover a file pasted as a data URI

Decode mode: paste a data:application/pdf;base64,… string and click Download to get back report.pdf without any server round trip.

Preview a Base64 image before using it

Decode mode: paste a data:image/jpeg;base64,… string and the image renders in the preview slot, which you can click to view full size in the lightbox.

Frequently asked questions

What kinds of files can I encode?
Any file works: images, PDFs, fonts, archives, JSON, plain text and more. The tool reads the file with the browser's FileReader and produces a Base64 data URI that includes the correct MIME type.
Why is the Base64 output larger than my file?
Base64 encodes 3 bytes of data into 4 characters, so a data URI is roughly 33% larger than the original file. That trade-off is normal and is the cost of embedding binary data as text.
What file name do I get when decoding?
The tool reads the MIME type from the data URI and names the download accordingly, such as decoded.png or decoded.pdf. If the type is unknown it falls back to a .bin extension.
Can it decode a plain Base64 string without the data: prefix?
Yes. If you paste a bare Base64 payload with no data: header, it is decoded as a generic binary file (application/octet-stream) and offered as a .bin download.
Is my file uploaded anywhere?
No. Encoding and decoding both run entirely client-side in your browser; nothing is uploaded and no server is contacted, so your files stay private on your device.

Related tools