File to Base64

Convert any file to Base64 and decode Base64 back to a downloadable file. No upload required.

A two-way converter: encode any file into Base64, or decode a Base64 string back into a downloadable file with the MIME type and filename you specify.

Encoding: two outputs for two different destinations

Encoding produces the full data URI — with a MIME prefix the browser detects from the file — and the raw Base64 below it, each with its own copy button. The data URI form belongs in HTML and CSS (image src attributes, font-face declarations, inline downloads); the raw form belongs in JSON payloads, XML, and database fields, which supply their own framing. Base64 always costs you a third in size: 4 output characters per 3 input bytes, so a 5 MB file becomes a 6,990,508-character string. That entire string is rendered into the page, so encoding very large files makes the tab sluggish — this workflow is built for icons, fonts, small documents, and API fixtures, not videos.

Decoding: the bytes are exact, the metadata is on you

In decode mode, the byte reconstruction is exact — Base64 is a lossless transport encoding. What the string cannot always tell the tool is what the bytes are: if your input carries a data URI header, the MIME type is extracted from it and filled in automatically; if you paste raw Base64, you supply the MIME type and filename yourself. Getting the MIME type wrong does not corrupt anything, but the filename extension is what your OS and applications key off, so name the output to match the content — decoded PNG bytes saved as report.pdf will be a byte-perfect PNG that nothing opens. The decoded byte count appears once you click out of the input field, which is a quick integrity check: it should be very close to three-quarters of the string length.

Text round trip
Input: A file containing: Hello, world!
Output: SGVsbG8sIHdvcmxkIQ==
The trailing == is padding — the 13 input bytes don't divide evenly by 3.
Spotting a PNG in the wild
Input: First bytes of any PNG file
Output: Base64 starting with iVBOR
File signatures survive encoding predictably: PNG starts iVBOR, PDF starts JVBER. Useful for eyeballing unknown payloads.

One thing people ask

Is Base64 a form of encryption?

No — it is an encoding, reversible by anyone in one function call, with no key involved. It exists so binary data can travel through text-only channels. If the content is sensitive, encrypt it first (the AES tool on this site does that), then Base64 the ciphertext.

For PDFs specifically, pdf-to-base64 and base64-to-pdf add a header validation step this general-purpose tool skips. For encoding plain text rather than files, the Base64 text encoder is the lighter path.

Further reading