PDF to Base64 Converter
Drop a PDF and get a Base64 string — raw, or as a data:application/pdf URI. Everything runs in your browser — the file is never uploaded.
How to convert a PDF to Base64
Drag any PDF onto the drop zone above (or click to browse). The tool reads it locally with the browser's FileReader API and produces a Base64 string. By default you get the raw Base64 payload — ideal for JSON or a database column. Click Copy to grab it. Use the Data URI toggle to wrap it as data:application/pdf;base64,JVBERi0xLjQK…, which you can drop into an href, iframe, or embed.
Why convert a PDF to Base64?
Base64 turns binary PDF bytes into plain ASCII text, which is exactly what you need anywhere a transport only carries text:
- Embed in JSON API payloads: JSON has no binary type, so a PDF must be Base64-encoded to ride inside a request or response body.
- Store in a DB text column: keep a generated invoice or report alongside its row in a
TEXT/VARCHARcolumn instead of a separate blob store. - Email / MIME attachments: SMTP and MIME encode attachments as Base64 under the hood — the same encoding you get here.
- Data URIs: the
data:application/pdf;base64,…form lets you reference a whole PDF inline, with no separate file to host.
Size warning
Base64 is ~33% bigger than the original binary, because every 3 bytes become 4 ASCII characters. A 5 MB PDF becomes ~6.7 MB of text. That overhead is fine for transport — JSON bodies, email, a quick paste — but it adds up:
- Database limits: watch column size caps (and row/packet limits) before storing large encoded PDFs as text.
- Payload bloat: a Base64 PDF inflates request sizes and memory use; for large or frequently reused files, an upload + URL reference is usually better.
Tip: Base64 size is predictable — roughly ceil(bytes / 3) * 4 characters. Use it to sanity-check against your column or payload limits before you commit.
Is this private?
Yes. The conversion happens entirely client-side in JavaScript. Your PDF is read into memory in the browser and encoded locally — it is never sent to a server. That matters for confidential PDFs like contracts, statements, or medical records: nothing leaves your machine. You can confirm it by opening DevTools → Network: adding a PDF fires no upload request.
Frequently asked questions
How do I convert a PDF to Base64?
Drop the PDF onto the converter above. It reads the file locally and outputs raw Base64 by default; toggle Data URI for the data:application/pdf;base64,… form, then click Copy.
Is it safe to convert a PDF to Base64 online?
On base64.dev, yes — everything runs in your browser. The PDF is never uploaded, so confidential documents stay on your machine.
How much bigger is a PDF after Base64 encoding?
About 33% larger. A 5 MB PDF becomes ~6.7 MB of text — fine for transport, but mind database column limits.
What is the data URI for a PDF?
It looks like data:application/pdf;base64,JVBERi0xLjQK… — the application/pdf MIME type, then ;base64,, then the encoded payload. Use it as an href, iframe, or embed source.
Need text, files, or URL-safe Base64?
The main base64.dev tool handles text, files, and URL-safe mode with auto-detect.
Open base64.dev →