Instant Encoding · 4 Code Snippets · Zero Uploads

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.

PDF 1.0–2.0 Encrypted PDFs Scanned PDFs Form PDFs Any Size
📄

Drop a PDF here or click to browse

Any PDF file scanned, encrypted, fillable, or standard

PDF application/pdf
Reading PDF…
📄
File name
MIME type application/pdf
Original size
Base64 size
Overhead
Original Base64 (+~33%)
Raw Base64 0 chars
Data URI 0 chars
PDF
Only Format Needed
4
Code Snippets
0ms
Server Latency
100%
Private & Secure

Convert a PDF to Base64 in Three Steps

No sign-up, no server uploads. Drop, encode, and copy in seconds.

1

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.

2

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.

3

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.

PropertyValueNotesSupport
📄MIME Typeapplication/pdfRegistered IANA media type for PDFUniversal
🔗Data URI Prefixdata:application/pdf;base64,Full prefix used in src / href attributesUniversal
📄File Extension.pdfPortable Document Format (Adobe)Universal
📊Base64 Overhead~33% largerEvery 3 bytes becomes 4 ASCII charactersExpected
🖥iframe Embed<iframe src="data:application/pdf;base64,…">Chrome, Edge, Safari support inline renderingModern browsers
🚫Firefox iframeLimited supportFirefox blocks data URIs in iframes for securityWorkaround needed
🔗Download link<a href="data:application/pdf;base64,…" download>Triggers PDF download in all major browsersUniversal
🛠API PayloadRaw Base64 string in JSON bodyUsed by REST APIs, document services, AI APIsUniversal

When You Need a PDF as Base64

Encoding PDFs as Base64 solves real problems across APIs, document workflows, email, and web embedding.

01

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.

02

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.

03

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.

04

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.

05

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.

06

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.

// PDF file → Base64 data URI
 
const reader = new FileReader();
 
reader.onload = (e) => {
  // Full data URI:
  const uri = e.target.result;
  // "data:application/pdf;base64,JVBERi…"
 
  // Raw Base64 only:
  const b64 = uri.split(',')[1];
 
  // Use as iframe src:
  iframe.src = uri;
 
  // Use in API payload:
  body.pdf_data = b64;
};
 
reader.readAsDataURL(pdfFile);

Frequently Asked Questions

Everything you need to know about encoding PDF files to Base64.

Base64 encodes every 3 bytes as 4 ASCII characters, producing output approximately 33% larger than the original binary. A 1 MB PDF becomes roughly 1.37 MB of Base64 text. This overhead is the unavoidable cost of representing binary data as printable ASCII. For large PDFs intended for serving over the web, using a hosted URL is more bandwidth-efficient. The size bar in the tool shows the exact overhead for your specific file.
There is no hard limit enforced by this tool. However, 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.
No. The entire encoding process uses the browser's native 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.
Use the full data URI as the 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.
Use the raw Base64 string (not the full data URI) as the value in your JSON request body: 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.
The MIME type for PDF is 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.
Yes. Use the full data URI as the 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.
Yes. Base64 encoding operates on the raw bytes of the PDF file, regardless of whether it is encrypted or password-protected. The encoded Base64 string represents the exact binary content of the file encryption metadata, password protection, and all. When the recipient decodes the Base64 back to a PDF, they will still need the correct password to open it. Encryption is preserved end-to-end.