PDF to Base64 Converter
Up to 10 MB. Nothing is uploaded — the file never leaves your device.
Use this in an <img src> attribute or a CSS url().
Without the data: prefix — for JSON payloads and APIs.
Shows the document in the page. For a download link, use the data URI in an <a href> with a download attribute.
Your files stay private
This conversion runs entirely inside your browser. The image is never uploaded, so nothing you encode here reaches our server or anyone else.
About Converting PDF to Base64
Encoding an image to Base64 is usually a web performance decision. Encoding a PDF almost never is. People convert documents because something on the other side — an e-signature service, an invoicing system, a tax authority, a messaging API — accepts files only as text inside a JSON field. This is a transport problem, and it has a different set of rules.
How to convert PDF to Base64
- 1 Drop your .pdf file onto the upload area.
- 2 Check the size line: the encoded string is about a third larger, and that is the number your API limit applies to.
- 3 Copy the raw string for a JSON field, or the data URI if you need to display or link the document.
What it is actually for
JSON has no way to carry raw bytes. If an API wants a document inside a JSON body, the document has to become a string first, and Base64 is the standard way to do that. You will meet it when sending a contract to an e-signature provider, submitting an invoice to a government portal, attaching a file through a transactional email API, or pushing a document onto a message queue. In each case the alternative is a multipart upload, which many APIs support and some do not.
Do not inline a PDF in a web page
The embed snippet on this page is there for the rare case where you genuinely need it — a self-contained HTML file, an offline report, an email preview. It is not a good way to publish a document. A linked PDF can be streamed: the viewer downloads the first pages and shows them while the rest arrives. A data URI cannot, because the browser must hold the entire decoded document in memory before the viewer sees a single byte of it. On a multi-megabyte file that turns an instant preview into a stall, and the page cannot be cached separately from the document either.
Watch the payload limit, not the file size
A 4 MB PDF becomes roughly 5.4 MB of text, and it is that larger number your API measures. Request body limits of a few megabytes are common, so a document that looks comfortably within range as a file can be rejected once encoded. When you hit that wall, the answer is usually not to compress the PDF harder: check whether the API offers a separate file-upload endpoint or a pre-signed URL, because those take the raw bytes and skip the 33% entirely. This page stops at 10 MB, which is already past what most JSON endpoints will accept.