PDF to Base64

Choose a PDF and get its Base64 — ready to paste into an API request, a test fixture or an HTML embed.

runs in your browserno uploadno sign-up

PDF file

Base64

Output appears here.

Output formats

Base64 only is what most APIs expect in a JSON string field (for example a "content" or "file" property). Data URI prefixes it with data:application/pdf;base64, for use in an <embed>, <iframe> or link href. JSON field wraps the value with the file name and content type, a common shape for upload endpoints. MIME (76 col) breaks the text into 76-character lines as RFC 2045 requires for email bodies.

Base64 makes the file about 33% larger — every 3 bytes become 4 characters — so a 3 MB PDF becomes roughly 4 MB of text. Check your API’s request size limit before sending large documents; many cap request bodies at 5–10 MB.

Frequently asked questions

How do I convert a PDF to Base64?

Choose or drop the PDF file. The Base64 appears on the right immediately; pick a format and click Copy or Save .txt.

Is my PDF uploaded to a server?

No. The file is read with your browser’s File API and encoded locally. Nothing is sent over the network, so confidential documents stay on your device.

How do I convert a PDF to Base64 on the command line?

Linux: base64 -w 0 file.pdf > file.txt (the -w 0 avoids line breaks). macOS: base64 -i file.pdf -o file.txt. PowerShell: [Convert]::ToBase64String([IO.File]::ReadAllBytes("file.pdf")).

Why is the Base64 bigger than the PDF?

Base64 uses 4 text characters for every 3 bytes, so output is about 4/3 the size of the file, plus line breaks if you choose the MIME format.

How do I embed a Base64 PDF in HTML?

Use the Data URI format: <iframe src="data:application/pdf;base64,…"></iframe>. Note that some browsers block top-level navigation to data: URLs and many mobile browsers will not render it inline; for large documents serve a normal file instead.