PDF to Base64
Encode a PDF to Base64 in your browser: copy a data:application/pdf;base64 URL, raw Base64 for email APIs, or JSON. Up to 25 MiB, never uploaded.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
PDF to Base64
Encode a local PDF to Base64 in your browser and copy it as a data URL, raw Base64 or a JSON attachment, with a %PDF- header check.
To convert a PDF to Base64, pick the file: the %PDF- header is checked and it is encoded in your browser. Copy the result as raw Base64 (what email and document APIs expect), a data:application/pdf;base64,… URL, or a JSON attachment object. Output is 4/3 of the file size, so a 2 MiB PDF becomes 2,796,204 characters.
How to use PDF to Base64
Choose a PDF up to 25 MiB. The %PDF- header is verified and the file is encoded straight away, in this browser tab.
Read the report: PDF version, the %%EOF end-of-file check, and the exact Base64 character count.
Pick Data URL, Raw Base64 or JSON attachment, then Copy or Download the text.
Why use PDF to Base64
Nothing is uploaded
The PDF is read and encoded in your browser; no bytes reach a server.
Header verification
Reads the %PDF- marker, the declared version and the trailing %%EOF so a truncated or misnamed file is flagged.
Exact size before you convert
Shows the character count from ceil(bytes ÷ 3) × 4 plus the 28-character data URL prefix.
Common use cases
- Attach an invoice PDF through a transactional email API whose attachment field takes the file content as a Base64 string.
- Embed a small terms-and-conditions PDF inside a JSON fixture so an automated test needs no external file.
- Store a signed document in a text-only column or a config file without setting up object storage.
Frequently asked questions
How much larger is a PDF after Base64 encoding?
About 33% larger for typical file sizes — the asymptotic ratio is exactly 4/3. A 2 MiB PDF becomes 2,796,204 Base64 characters, plus the 28-character data:application/pdf;base64, prefix. Smaller files can grow by more than 33% because of Base64 padding, so plan attachment limits against the encoded size, not the file size.
Link to answerWhat is the largest PDF I can convert here?
25 MiB. Both the raw bytes and the Base64 text (about 35 MB for a 25 MiB file) have to be held in memory at once, so larger files risk slowing or crashing the tab.
Link to answerHow can I tell a real PDF from a renamed file?
Every PDF starts with the five bytes %PDF- followed by a version such as 1.7, per ISO 32000-1 section 7.5.2, and ends with the %%EOF marker. This tool reads both and refuses to encode a file that fails the header check.
Link to answerIs a Base64 PDF encrypted or protected in any way?
No. Base64 is an encoding, not encryption — anyone with the string can decode it back to the original PDF in one step. Use real encryption or a signed URL if the document is confidential.
Link to answerDo email APIs want the data URL or raw Base64?
Raw Base64. Attachment fields in email and document APIs usually take just the encoded bytes (starting JVBERi0 for a PDF, which is %PDF- encoded) plus a separate filename and MIME type. Use the data:application/pdf;base64, form only where a URL is expected, such as an <iframe> or <a href>.
Link to answerHow do I convert Base64 back to a PDF?
Use the companion Base64 to PDF tool: paste the raw Base64 or the full data URL and it decodes the bytes, checks the %PDF- header, previews the document and downloads it as a .pdf file.
Link to answerEmbed this tool on your site
Add the PDF to Base64 widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/pdf-to-base64"
title="PDF to Base64 — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/pdf-to-base64?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>