Loading File to Base64 Converter...

How to Convert a File to Base64

Step 1

Upload Your File

Click "Upload File" or drag a file onto the upload area. Any file type up to 10 MB works, and "Sample" loads a small text file to try it with.

•
Any file type: PDF, DOCX, XLSX, images, ZIP, JSON, XML and the rest
•
Drag & drop: drop the file straight onto the upload area
•
Empty files: a 0-byte file gets a message, since there is nothing to encode
Step 2

Check the Result

The file is encoded to standard Base64 as soon as the browser has read it, usually well under a second for small files and a few seconds for one close to 10 MB.

•
File details: name, the type your browser reports, and size
•
Byte for byte: decoding the text gives back exactly the file you picked
•
Long results: over a million characters, the panel shows the start only; Copy and Download still use all of it
Step 3

Copy or Download the Base64 String

Copy puts the Base64 text on your clipboard, Download saves it as a .txt file named after the original file. Neither adds a data: prefix. Typical places to paste it:

•
API requests: a file field inside a JSON payload
•
Databases and configs: small files stored in a text column or a secret
•
Test fixtures: a known file embedded right in your test code

What is File to Base64 Encoding?

Base64 writes any sequence of bytes using only letters, digits, "+", "/" and "=", so a binary file can travel through systems that only handle text. It works the same for PDFs, ZIP archives, Office documents and images.

You will run into it in REST APIs that accept file contents in JSON and in data URIs. For a PDF specifically, the PDF to Base64 converter also checks that the file really is a PDF.

Frequently Asked Questions

How do I convert a file to Base64?

Click "Upload File" or drop the file onto the left panel. The encoded text appears on the right as soon as the browser has read the file, and you can copy it or save it as a .txt file. To turn Base64 back into a file, use the Base64 to File decoder.

Does the copied text include the data: prefix?

No. Copy and Download give you plain RFC 4648 Base64 on a single line, which is what most APIs and JSON fields expect. If you need a data URI for HTML or CSS, put "data:<type>;base64," in front yourself, for example "data:application/pdf;base64," for a PDF or "data:image/png;base64," for a PNG.

Which kinds of files can I encode?

Anything: PDFs, Office documents, ZIP archives, images, audio, fonts, plain text. Base64 works on the raw bytes, so the page never needs to open or understand the file. The result decodes back to exactly the same bytes, including a byte-order mark or Windows line endings in a text file.

What is the file size limit?

Files up to 10 MB. Bigger ones get a message instead of a result. Keep in mind that Base64 is about a third larger than the original, so a 9 MB file turns into roughly 12 MB of text; for results that long the output panel shows the first part only, while Copy and Download still hand you the whole string.

Is my file uploaded anywhere?

No. The file is read and encoded in your browser with the FileReader API, it is not sent to our server, and nothing is kept once you remove the file or close the page. Bear in mind that Base64 is an encoding, not encryption: anyone who gets the text can turn it back into the file.

Is this File to Base64 converter free?

Yes, and there is no sign-up. The only limit is the 10 MB size per file.