Encode files as Base64 and back
- Free
- No sign-up
- No upload
- Works offline
Tool facts
- Opens
Any file- Saves as
TXTAny file- Price
- Free, no sign-up, no watermark
- Are files uploaded?
- No. Everything is processed in this browser, on your device.
- Batch processing
- One file at a time
- Offline use
- Works without a connection once this page has loaded
- Browser
- A recent Chrome, Edge, Firefox or Safari, on computer or phone.
- Limits
- No fixed file size limit; very large files depend on your device's memory and may fail on phones.
Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.
About File to Base64
File to Base64 converts any file (PDF, image, font, audio, ZIP or anything else) into Base64 text, and turns Base64 text back into the original file. Base64 represents binary data with 64 printable characters, which lets you embed files in JSON, XML, HTML, CSS, emails or API requests that only accept text. Choose plain Base64, a data URI such as data:application/pdf;base64,…, MIME-style line breaks every 76 characters, or the URL-safe Base64URL alphabet used in JWTs and web APIs.
To decode, paste Base64 or a complete data URI. Whitespace, line breaks, URL-safe characters and missing padding are handled automatically, and the tool detects the real file type from its first bytes (PNG, JPEG, PDF, ZIP, MP3, MP4 and more) to suggest the right extension and show a preview of images, audio, video and text. Base64 makes data about 33% larger than the original. Everything runs in your browser; nothing is uploaded.
File to Base64 runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.
How to use File to Base64
- To encode, keep File → Base64 selected and drop a file onto the page or click to choose it.
- Pick Base64 or Data URI and, if needed, line breaks or URL-safe output, then click Copy or Download .txt.
- To decode, switch to Base64 → File and paste the Base64 text or data URI (or load a .txt file).
- Check the detected type and preview, adjust the file name, and click Download file.
Frequently asked questions
Why is the Base64 text bigger than my file?
Base64 encodes every 3 bytes as 4 characters, so the text is about 33% larger than the original, plus a little more with line breaks or a data URI prefix. It's a way to transport binary data as text, not a way to compress it.
What is a data URI?
A data URI puts the file type and the Base64 data into one string, such as data:image/png;base64,iVBOR…, that can be used directly as the src of an image or the url() of a CSS background, without a separate file.
How do I convert Base64 back to a PDF or image?
Switch to Base64 → File and paste the text. The tool recognises the format from the decoded bytes, names the file accordingly (for example file.pdf) and shows a preview for images, so you only need to click Download file.
Why do I get an invalid character error?
Base64 may only contain A–Z, a–z, 0–9, + and / (or - and _ in URL-safe Base64) and = padding at the end. The message shows the first character that doesn't belong, often a quote, a backslash escape or part of surrounding JSON that was copied along.
Is there a size limit, and is my file uploaded?
Nothing is uploaded; encoding and decoding happen in your browser. Files up to roughly 100 MB work on most computers. Very long results are only partly shown in the text box to keep the page fast, but Copy and Download always use the complete text.