Base64 Encode/Decode

Base64 to PDF Converter: Decode Base64 to PDF Online

Decode a Base64 string to a downloadable PDF file. Handles raw Base64 and data URIs. No server upload, runs entirely in your browser.

100% client-side. Your data never leaves your browser.

Related Tools

Decode Base64 to PDF

Paste a Base64 encoded PDF string to decode and download it as a PDF file. This tool accepts both raw Base64 strings (starting with JVBERi) and full data URIs (data:application/pdf;base64,...). The conversion is instant and runs entirely in your browser.

How to Use

  1. Switch to the “Base64 to PDF” tab above
  2. Paste a Base64 string or data URI
  3. The tool detects the PDF format and shows file details
  4. Click Download to save the PDF

Where You Encounter Base64 PDFs

API responses

Document generation APIs (invoice generators, contract platforms, reporting services) frequently return PDFs as Base64 strings in JSON responses:

{
  "status": "success",
  "document": "JVBERi0xLjQKMSAwIG9iago...",
  "filename": "invoice-2024-001.pdf"
}

Email attachments (MIME)

Raw email source shows PDF attachments as Base64 encoded blocks between MIME boundaries:

Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="report.pdf"

JVBERi0xLjQKMSAwIG9iago8PAovVHlwZS...

Database records

Applications that store documents in text columns (common in early stage products or prototypes) encode PDFs as Base64 strings. Extracting the document requires decoding.

Configuration and automation

CI/CD pipelines, infrastructure as code tools, and Kubernetes secrets sometimes store PDF certificates or license files as Base64 encoded values in configuration files.

PDF Detection

Every PDF file begins with the magic bytes %PDF (hex 25 50 44 46), followed by a version number like 1.4, 1.7, or 2.0. In Base64, these bytes encode to JVBERi. This tool uses this signature to automatically identify PDF content, even without a data URI prefix.

Decoding in Code

JavaScript

function base64ToPdfBlob(base64) {
  const binary = atob(base64);
  const bytes = new Uint8Array(binary.length);
  for (let i = 0; i < binary.length; i++) {
    bytes[i] = binary.charCodeAt(i);
  }
  return new Blob([bytes], { type: 'application/pdf' });
}

const blob = base64ToPdfBlob(base64String);
const url = URL.createObjectURL(blob);
window.open(url);

Python

import base64

base64_string = "JVBERi0xLjQK..."
pdf_bytes = base64.b64decode(base64_string)

with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)

Command line

echo "JVBERi0xLjQK..." | base64 -d > output.pdf

Inline PDF Rendering

Browsers can render PDFs from data URIs in iframe and embed elements:

<iframe
  src="data:application/pdf;base64,JVBERi0xLjQK..."
  width="100%"
  height="600px"
></iframe>

This works in Chrome, Edge, and Firefox with their built in PDF viewers. Safari may prompt a download instead. For production applications, dedicated PDF viewers (pdf.js) handle edge cases better than data URI embedding.

Size Limits

Browser based Base64 decoding works reliably up to tens of megabytes. Practical considerations:

This tool sets a 50 MB limit to prevent out of memory errors. For very large PDFs, use command line tools or server side processing.

Security Notes

PDFs can contain JavaScript, form submission actions, external links, and embedded files. Base64 decoding does not sanitize the content. You get the exact original file. If the Base64 comes from an untrusted source, open the decoded PDF in a sandboxed viewer or scan it before processing.

For the reverse operation, see PDF to Base64. For general file decoding, use Base64 to File. For text encoding, the main Base64 Encoder handles that.