PDF to Base64
Upload or drop a PDF to get a Base64 string you can paste into APIs, configs, or tests.
Your PDF is processed locally in your browser and is not uploaded. We do not save or store your file on our servers (same privacy model as Base64 to PDF).
Drop a PDF here or click to upload
Only PDF files are accepted.
How to convert a PDF to Base64
- 1. Upload your PDF— click “Choose file” or drag and drop any
.pdffile onto the drop zone above. Only PDF files are accepted; other formats are rejected before any processing occurs. - 2. Copy the Base64 output— once the file is read, the encoded string appears in the output area. Click “Copy Base64” to copy it to your clipboard in one click.
- 3. Paste it wherever you need it — use the raw Base64 string in API request bodies, JSON configs, test fixtures, or prepend the data URL prefix (
data:application/pdf;base64,…) to embed it directly in HTML.
Why encode a PDF to Base64?
PDF files are binary data — they contain bytes that are not safe to transmit over text-only channels such as JSON bodies, XML documents, email headers, or URL parameters. Base64 encoding converts every 3 bytes of binary data into 4 printable ASCII characters, making it safe to embed in any text-based protocol without corruption or escaping issues. The trade-off is a roughly 33% increase in size, which is usually acceptable for document payloads.
A Base64-encoded PDF always starts with JVBERi0x — the Base64 encoding of the PDF magic bytes %PDF-1. You can use this prefix to quickly verify that a string is likely a valid PDF before attempting to decode it.
Common use cases
- Sending PDFs in REST or GraphQL APIs — many document-management, e-signature, and reporting APIs (DocuSign, Adobe Sign, AWS Textract, etc.) accept PDF payloads as Base64 strings inside a JSON field rather than as multipart form uploads.
- Embedding PDFs in HTML — a
data:URI lets you inline a PDF inside an<iframe>or<object>tag without a separate HTTP request, which is useful for offline-capable apps and email HTML. - Writing automated tests — fixture files for unit and integration tests are often stored as Base64 strings directly in the test source so the test suite has no external file dependencies.
- Storing documents in databases or config files — Base64 strings can be stored in text columns (PostgreSQL, MySQL, SQLite) or YAML/JSON config files where binary blobs are not allowed.
Frequently asked questions
- Is my PDF uploaded to your servers?
- No. The file is read and encoded entirely inside your browser using the
FileReaderAPI. No bytes from your PDF ever leave your device. You can go offline and the tool will still work. - What file types are accepted?
- Only PDF files. The tool checks both the MIME type and the file extension, and additionally verifies the PDF magic-byte signature (
%PDF) in the decoded bytes. Any file that fails these checks is rejected with an error message. - Does the output include the data URL prefix?
- The output is raw Base64 without a prefix, which is what most APIs expect. If you need a data URL, prepend
data:application/pdf;base64,to the copied string. - Is there a file size limit?
- There is no server-side limit because the file is never uploaded. The practical limit is your browser's available memory. Files of several hundred megabytes encode without issue in most modern browsers.
- How do I go the other way — Base64 back to a PDF?
- Use the companion Base64 to PDF tool — paste any Base64 string and preview or download the resulting PDF file instantly.