About this tool
Convert a local PDF into a Base64 data URL in your browser, with the exact encoded size and a header check.
The PDF to Base64 converter turns a local PDF into a Base64 data URL — the data:application/pdf;base64,… string defined by RFC 2397, with the payload encoded per RFC 4648. Because Base64 writes every three bytes as four characters, the output is exactly one third larger than the file. It is built for developers wiring PDFs into email APIs, JSON request bodies and database columns that only accept text, and it checks the %PDF- header before encoding so a renamed file is caught early.
Open PDF to Base64 on AltFTool — it loads instantly in your browser.
Select a file with 'Choose a PDF (up to 25.0 MiB)' — the %PDF- header is verified before encoding, so a renamed non-PDF is rejected early.
Press 'Convert to Base64' to encode the file locally; the report lists the PDF version, the %%EOF marker check and the exact Base64 character count.
Press 'Copy data URL' for the full data:application/pdf;base64 string, or 'Download .txt' to save it as <filename>.base64.txt.
The PDF is read and encoded in your browser; no bytes reach a server.
Reads the %PDF- marker, the declared version and the trailing %%EOF so a truncated or misnamed file is flagged.
Shows the character count from ceil(bytes ÷ 3) × 4 plus the 28-character data URL prefix.
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.
25 MiB. Both the raw bytes and the roughly 34 MB text output have to be held in memory at once, and a JavaScript string is capped near 512 MiB in V8, so larger files risk crashing the tab.
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.
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.
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>