PDF to Base64 Encoder
Drop any PDF file and instantly get a Base64 string, data URI, and ready-to-paste JavaScript, Python, and cURL snippets. Nothing ever leaves your browser.
Drop a PDF here or click to browse
Any PDF file scanned, encrypted, fillable, or standard
Convert a PDF to Base64 in Three Steps
No sign-up, no server uploads. Drop, encode, and copy in seconds.
Drop or Browse Your PDF
Drag any .pdf file onto the drop zone or click to open a file picker. The file is read locally by your browser using the native FileReader API nothing is uploaded to any server, ever.
Instant Base64 Encoding
The browser reads the raw PDF bytes and converts them to a Base64 string using FileReader.readAsDataURL(). The MIME type application/pdf is automatically set to build a complete data:application/pdf;base64,… URI.
Copy a Snippet or the Raw String
Copy the raw Base64 or full data URI, download as .txt, or switch to the Snippets tab to grab a ready-to-paste JavaScript Fetch payload, Python base64.b64encode() equivalent, cURL request body, or inline <iframe> embed snippet.
Everything You Need to Encode a PDF
A complete PDF encoding toolkit with size analysis, metadata display, and developer snippet generation.
Any PDF Supported
Encodes any valid PDF file regardless of version (1.0–2.0), encryption state, content type (text, scanned images, forms), or number of pages. The MIME type is always set to application/pdf in the data URI prefix.
Size Overhead Report
A visual size comparison bar shows the original PDF size vs. the Base64 output side by side. The exact overhead percentage is calculated so you can judge whether embedding is practical for your file size before deploying it.
4 Developer Snippets
One-click copy for: JavaScript fetch() API POST payload, Python base64.b64encode() equivalent, curl command with JSON body, and HTML <iframe> embed all pre-filled with your encoded PDF.
Download Base64 as Text
Download the raw Base64 string or the full data URI as a .txt file. Useful for storing in a database column, dropping into a configuration file, or sharing the encoded PDF without a file hosting service.
One-Click Copy
Separate copy buttons for the raw Base64 string and the full data:application/pdf;base64,… URI. Copy exactly what you need the raw string for API payloads, or the full URI for inline HTML embeds.
100% Private
All encoding uses FileReader.readAsDataURL() a native browser API. Your PDF bytes never leave your device. Safe for confidential contracts, financial reports, medical records, and legal documents.
PDF Base64 MIME Type & Data URI Format
Everything you need to know about the MIME type, data URI format, and browser support for Base64-encoded PDFs.
| Property | Value | Notes | Support | |
|---|---|---|---|---|
| 📄 | MIME Type | application/pdf | Registered IANA media type for PDF | Universal |
| 🔗 | Data URI Prefix | data:application/pdf;base64, | Full prefix used in src / href attributes | Universal |
| 📄 | File Extension | .pdf | Portable Document Format (Adobe) | Universal |
| 📊 | Base64 Overhead | ~33% larger | Every 3 bytes becomes 4 ASCII characters | Expected |
| 🖥 | iframe Embed | <iframe src="data:application/pdf;base64,…"> | Chrome, Edge, Safari support inline rendering | Modern browsers |
| 🚫 | Firefox iframe | Limited support | Firefox blocks data URIs in iframes for security | Workaround needed |
| 🔗 | Download link | <a href="data:application/pdf;base64,…" download> | Triggers PDF download in all major browsers | Universal |
| 🛠 | API Payload | Raw Base64 string in JSON body | Used by REST APIs, document services, AI APIs | Universal |
When You Need a PDF as Base64
Encoding PDFs as Base64 solves real problems across APIs, document workflows, email, and web embedding.
REST API & Document Service Payloads
Many document generation, e-signature, and OCR APIs (DocuSign, Adobe Sign, AWS Textract, Google Document AI) accept PDF files as Base64-encoded strings inside a JSON request body. Instead of managing file uploads and multipart forms, you encode the PDF and paste the Base64 string directly into your request payload, Postman collection, or curl command.
Inline PDF Embeds in HTML
Embed a PDF directly into a web page without hosting the file on a server using <iframe src="data:application/pdf;base64,…">. Ideal for self-contained single-file reports, offline dashboards, and portable documentation pages where no external asset references are allowed. Supported in Chrome, Edge, and Safari.
Email Attachments via API
Email service providers like SendGrid, Mailgun, and AWS SES accept email attachments as Base64-encoded content in their API request JSON. Encode your PDF invoice, receipt, or report here and paste the Base64 string directly into the content field of your API attachment object, eliminating the need for temporary file storage.
Database Storage of PDF Files
When you need to store a PDF alongside structured data in a database, Base64 encoding allows you to save the entire file as a text string in a TEXT, VARCHAR(MAX), or BLOB column. While not optimal for large files, this pattern is practical for storing receipts, certificates, or signed contracts in document-oriented or relational databases.
PDF Download Links Without a Server
Create a clickable download link for a PDF in a purely client-side web app using <a href="data:application/pdf;base64,…" download="file.pdf">Download</a>. This lets users download the file without any server infrastructure, file hosting, or signed URLs the entire PDF is embedded in the link itself.
AI & LLM Document Pipelines
AI APIs that accept documents (such as Claude, Gemini, and GPT-4o) often accept PDF files as Base64-encoded content in API request payloads. Encode your document here and pass the Base64 string directly to the API's document content block no file upload endpoint or temporary storage bucket required during development and testing.
PDF to Base64 Encoding Explained
PDF files are binary data sequences of bytes representing the document structure, embedded fonts, images, and cross-reference tables as defined in the ISO 32000 standard. Base64 encoding converts this binary data into printable ASCII text by mapping every 3 bytes to 4 characters from a 64-character alphabet (A–Z, a–z, 0–9, +, /), producing output approximately 33% larger than the source file.
The browser's FileReader.readAsDataURL() API reads the PDF file bytes and returns a complete data URI in the format data:application/pdf;base64,[encoded-data]. The MIME type application/pdf is the IANA-registered media type for PDF files (RFC 3778) and is included automatically in the data URI prefix.
The resulting Base64 string can be used as a JSON field value in API payloads, as the src of an <iframe> to embed the PDF, as an href of an <a download> element, or stored as a string in a database. The data URI format is particularly useful for completely self-contained HTML documents with no external dependencies.
Frequently Asked Questions
Everything you need to know about encoding PDF files to Base64.
FileReader.readAsDataURL() holds the entire file and its Base64 output in browser memory simultaneously. For PDFs larger than 10–20 MB, the browser tab may slow down and the resulting Base64 string may be too large to paste into most text fields. Very large Base64 strings can also cause performance issues when used in iframe src or anchor href attributes. For large PDF files, a hosted URL or file upload endpoint is generally more practical.FileReader API. Your PDF bytes are read directly from your local disk into browser memory no network request is made and nothing is sent to any server. The tool works fully offline after the initial page load, making it safe for confidential contracts, financial reports, medical records, and proprietary documents.src attribute of an <iframe> element: <iframe src="data:application/pdf;base64,JVBERi…" width="100%" height="600"></iframe>. This works in Chrome, Edge, and Safari. Firefox blocks data: URIs in iframes for security reasons use a Blob and URL.createObjectURL() as a workaround in Firefox. The Snippets tab includes both approaches.fetch(url, { method: 'POST', body: JSON.stringify({ pdf: base64String }) }). Most document and e-signature APIs (DocuSign, Adobe Sign, Salesforce) expect the raw Base64 string without the data:application/pdf;base64, prefix. The JavaScript Fetch snippet in the Snippets tab is pre-filled and ready to paste.application/pdf, registered in RFC 3778. When used in a data URI, the full format is data:application/pdf;base64,[encoded-string]. This MIME type is recognised by all browsers and must be included in the data URI prefix for the browser to render the PDF correctly rather than treating it as plain binary data. This tool always generates the correct prefix automatically.href of an anchor tag with the download attribute: <a href="data:application/pdf;base64,…" download="document.pdf">Download PDF</a>. This triggers a PDF download in all major browsers without any server infrastructure. For very large PDFs, the Blob + URL.createObjectURL() approach is more memory-efficient and avoids URL length limits.