
Turn any PDF into a Base64 text string — or decode a Base64 string back into a PDF — in seconds. Your file never leaves your browser.
By Amir Shahzad · Last updated 20 November 2026 · Data: RFC 4648 (Base64), pdf-lib 1.17; ISO 32000 (PDF standard)
No PDF chosen yet. Pick a PDF above — or try the built-in sample first.
Short answer: choose your PDF, press Encode to Base64, and you get the text string — about 33% larger than the file — ready to copy or download. Decode mode turns a Base64 string back into a working PDF. Nothing is uploaded.
data:application/pdf;base64, prefix.Base64 is a way to write binary data as plain text. A PDF is binary — it contains bytes that are not letters — so it cannot travel inside a JSON object, an email body, or a database text field without breaking. Base64 solves that by regrouping the file's bytes into 6-bit chunks and writing each chunk as one of 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. The result is pure text, safe to paste anywhere text goes. The price is size: every 3 bytes become 4 characters, so the output is about 33% larger than the original file. That is the whole trade — nothing is compressed, nothing is encrypted.
That one property explains every real use. JSON APIs accept a PDF as a Base64 string inside a JSON field — this is how invoices travel into e-invoicing and accounting APIs that only speak JSON. Data URIs (data:application/pdf;base64,...) let a browser open or embed a PDF straight from a string, with no file hosted anywhere. Email (MIME) has encoded attachments in Base64 since the 1990s. And databases that only store text can hold a whole document as one field. In each case the string is a transport format, not a storage format — decode it back to a PDF as soon as it arrives.
The built-in sample is a one-page document (about 1 KB). Encode it and the first characters look like this:
JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlIC9DYXRhbG9nL1BhZ2VzIDIgMCBSPj4K...
Every PDF's Base64 starts with JVBERi0 — that is the Base64 of the %PDF- header every PDF file opens with. It is a quick check: if a string you received does not start with JVBERi0, it is not a PDF. With the data URI option ticked, the same output starts with data:application/pdf;base64,JVBERi0xLjQK... and can be pasted straight into a browser address bar to preview the document.
| Original PDF size | Base64 text size | Overhead |
|---|---|---|
| 100 KB | ~134 KB | +33% |
| 1 MB | ~1.37 MB | +33% |
| 3 MB | ~4 MB | +33% |
| 10 MB | ~13.7 MB | +33% |
The 4/3 ratio is exact and predictable: 3 bytes in, 4 characters out. That is why large PDFs make poor Base64 — a 10 MB scan becomes nearly 14 MB of text, which many APIs and forms reject. Compress the PDF first (our compress tool) if the string is too long for its destination.
By the numbers: more than 400 billion PDFs were opened in Adobe Acrobat in the last year, and 16 billion documents were edited there (Adobe Fast Facts, 2024). A large share of those documents eventually cross a system boundary as Base64 — inside an API call, an email, or a database field — which is why a private, in-browser encoder matters: the document never has to pass through a conversion server.
JVBERi0 check is built in: decode mode verifies the bytes start with the %PDF header before offering a download, so a mistyped string fails loudly instead of producing a broken file.Online Base64 encoders are everywhere, and most of them upload your file to convert it — the standard server pattern. For a contract, an invoice or a statement, that upload hands the whole document to a third party for a job your browser can do in milliseconds: Base64 encoding is a pure byte regrouping, defined in RFC 4648, with no server-side step at all. This tool does it locally, and decode mode runs the same check a careful developer would run by hand — verifying the %PDF magic bytes. The honest limit is size: a very large PDF makes a very long string, and pasting megabytes of text into a form is awkward no matter where the encoding happens. For those, compress first, then encode.
Anyone who sees the string can decode it in one click. Never email or post a Base64 string as if it were encrypted — password-protect the PDF first.
A 3 MB PDF becomes about 4 MB of text. APIs and forms often cap field length, so a long string can be rejected — compress the PDF first.
Base64 ignores line breaks when decoding, but a single wrong character corrupts the output. Copy the whole string, not a trimmed piece of it.
A password-protected PDF cannot be read until it is unlocked. Unlock it first with our unlock tool, then encode the unlocked copy.
Yes — unlimited files, forever. No trial, no watermark, no account, no payment step. The encoding runs entirely in your browser.
No. Your PDF is read and encoded 100% in your browser and never leaves your device. Check the Network tab: nothing is sent to any server.
Base64 is a way to represent binary data as plain text, using only letters, numbers, + and /. It is how PDFs travel inside JSON APIs, data URIs, email attachments (MIME) and database fields that only accept text. The encoded text is about 33% larger than the original file.
A data URI (data:application/pdf;base64,...) lets a browser open or embed the PDF directly from a string — useful for previews, tests and HTML embeds without hosting a file. Tick the box to include the data:application/pdf;base64, prefix.
Yes — switch to Decode mode, paste the Base64 string (with or without the data URI prefix), and download the rebuilt PDF. The tool checks that the decoded bytes start with the %PDF header before offering the download.
There is no server limit because there is no server — the only limit is your device's memory. Everyday PDFs up to tens of megabytes encode in seconds. Base64 output is about 4/3 the size of the original, so a 3 MB PDF becomes about 4 MB of text.
No. Base64 is encoding, not encryption — anyone can decode it instantly. Never treat a Base64 string as protected. For real protection, password-protect the PDF first with our protect tool, then encode it.
Encoding: RFC 4648 (Base64 alphabet and padding), implemented with the browser's own binary-to-text conversion. Sample document: pdf-lib 1.17. PDF format: ISO 32000-1:2008. Scale figure: Adobe Fast Facts, 2024 — more than 400 billion PDFs opened in Adobe Acrobat in the last year. Tested 20 November 2026 on the built-in 1-page sample document (encode → decode round-trip verified byte-for-byte). Base64 is not encryption: do not treat an encoded string as protected, and never share a Base64 string of a document you would not share as a PDF.
Need the document as structured data instead? Our PDF to JSON converter turns the same PDF into labelled JSON. Need just the words? Extract text from PDF pulls the text out as plain text.
Educational content only. Nothing on this site is legal or professional advice.