File to Base64 Converter

File Input

Drop any file here or click to upload

PDF, Word, Excel, ZIP, images, audio, video: any file type up to 10MB

PDFDOCXXLSXZIPPNG/JPGMP3+ more
Output:

Base64 Output

What is File to Base64 Conversion?

Base64 encoding converts binary file data into a plain-text string. This lets you embed any file (Word documents, ZIP archives, audio, or images) directly inside JSON, XML, HTML, or API request bodies without needing a separate file upload endpoint. The RFC 4648 standard defines the encoding algorithm used by this tool.

Modern APIs such as the browser FileReader API produce data URIs in the format data:;base64,: the exact format this tool outputs by default.

The page reads your file with FileReader.readAsDataURL(), which hands the bytes back already encoded, so it never runs into the Latin-1 limit that makes btoa() throw on binary data. Raw Base64 is that same string with the data:...;base64, prefix cut off. The file goes from your disk into this tab and no further.

How to Use the File to Base64 Converter

There is no sample on this page because it needs a real file from your disk. Pick one, choose the output shape, then take the text away.

1

Upload a File

Click Upload File or drag and drop onto the left File Input panel. Supports PDF, Word, images, ZIP, and any file type up to 10MB. Example: subscriber bill PDF, carrier invoice, or contract.

2

Choose Output Format

Select Data URI for a full data:mime;base64,... string (HTML/CSS ready), or Raw Base64 if your API expects just the encoded data.

3

Copy or Download

Copy puts the string on your clipboard; Download saves it under the original name, so invoice.pdf becomes invoice.pdf.base64.txt. The bar under the output shows the character count, the encoded size and the original size side by side. Clear on the left resets everything.

When You'd Actually Use This

API File Uploads via JSON

Many REST APIs, including Twilio MMS and document APIs, accept files as Base64 strings in JSON bodies, bypassing the need for multipart form data.

Kubernetes & CI/CD Secrets

Store TLS certificates, SSH keys, or config files as Base64 in Kubernetes Secrets or GitHub Actions Encrypted Secrets.

Embedding Files in HTML/CSS

Embed fonts, icons, or small assets directly in data URIs inside CSS or HTML to reduce HTTP requests and create self-contained documents.

Email Attachments (SMTP)

Build MIME-encoded emails (RFC 2045) manually or through SMTP libraries. Attachments must be Base64-encoded before being included in the email body.

Common Questions

What file types are supported?

All file types are supported. The tool uses the FileReader API to read raw binary data and encode it, regardless of file format.

Why is the Base64 string larger than my file?

Base64 writes every 3 bytes as 4 ASCII characters, so the output is about a third bigger than the file, plus up to two padding characters at the end. A 600 KB PDF comes out near 800 KB of text. That overhead is part of the encoding, not a bug.

Which output format should I use?

"Data URI" is what you paste into an <img src>, an <embed> or a CSS url(), because the browser needs the MIME type in front. "Raw Base64", the default here, suits API request bodies and JSON fields where the type travels separately.

Can I convert the Base64 back to the original file?

Yes. Paste the string into the Base64 to File page and it gives you the original file to download.

Is there a file size limit?

The tool supports files up to 10MB. Larger files may cause browser performance issues depending on available memory.

Is my file data private?

Yes. The browser reads the file from your disk and the encoding happens in this tab; the page has no upload endpoint for it. Closing the tab is enough to throw the result away.

Related Base64 Tools

Complete your Base64 workflow: