🔨 All in one Utilities

PDF to Base64 Converter

Great utilities that help you design, program and maintain your website

utilities for you to make a website
Home » Utilities » PDF to Base64 Converter

PDF to Base64 Converter

Drop a .pdf here, or click to choose one
The file is read in your browser. Nothing is uploaded.
File
Original size
Encoded size
Overhead
Pages

Note: The encoded size, not the file size, is what an API body limit is measured against. If your gateway caps requests at 1 MB, the largest PDF you can send inline is around 750 KB before JSON escaping takes its own share.

Base64 exists because some transports only carry text. A PDF is binary, so to put one inside a JSON request body, an XML envelope, a SOAP call to a document service, or an email attachment header, it has to be re-expressed using 64 printable characters. This converter does that step and nothing else — the file is read with the browser's own FileReader and never leaves the machine, which matters given how often the PDF in question is a contract or an invoice.

The practical thing to watch is the size. Encoding turns every three bytes into four characters, so the string is about 33% larger than the file, and then whatever you paste it into adds its own weight — JSON escaping, XML entities, and quoted-printable email encoding all inflate it further. A 4 MB PDF becomes roughly 5.5 MB of string before any of that. Many API gateways cap request bodies at 1 MB or 10 MB, so the encoded size shown below is the number that decides whether the request will be accepted, not the file size on disk.

The output is offered raw and as a data URI. Raw is what an API field wants. The data URI, with the media type prefix, is what you need for an anchor's href or an object's data attribute — though browsers have steadily restricted top-level navigation to data URIs, so a link that opens a PDF this way will be blocked in most of them. Embedding it inside an iframe or an object element still works, and the snippets below use that form.

Frequently Asked Questions

Is my PDF uploaded to a server?

No. The file is read with FileReader in your own browser and the encoding happens locally. You can verify it by opening the network tab while converting, or by disconnecting from the internet — the tool keeps working.

How large a PDF can I convert?

The limiting factor is memory: the file, the encoded string and the copy in the textarea all exist at once, so budget roughly four times the file size. In practice anything up to about 20 MB is comfortable on a desktop browser, while a phone will struggle well before that.

Why will my browser not open the data URI link?

Chrome, Firefox and Safari all block top-level navigation to data: URIs, because it was widely used for phishing pages that looked like they came from the site you were on. Embedding the same URI in an iframe or object element still renders, and that is what the generated snippet uses.

Should I store PDFs as Base64 in a database?

Rarely. You pay the 33% size penalty on storage, on every backup and on every query that touches the row, and you lose the ability to stream the file. Storing the bytes in object storage and keeping a URL in the database is almost always the better shape — Base64 is a transport format, not a storage format.

Related Utilities