Free Base64 to PDF Converter Online. Convert PDFs to Base64 strings or decode Base64 to PDFs instantly. Perfect for embedding PDFs in HTML, JSON, or APIs.
Click to upload PDF
PDF files up to 10MB
PDF will be available here after decoding
A Base64 PDF is a PDF file that has been encoded into a text string using Base64 encoding. This allows PDF documents to be embedded directly in HTML, JSON, APIs, or other text-based formats without requiring separate PDF files or external URLs.
Key Benefits:
• Embed PDFs directly in HTML without external files
• Store PDFs in databases as text strings
• Include PDFs in JSON APIs and configuration files
• Send PDFs via email or messaging systems that only support text
• Create self-contained HTML documents with embedded PDFs
Base64 PDFs are commonly used for embedding documents in web applications, storing PDFs in databases, sending PDFs through APIs, and including PDFs in JSON responses. However, Base64 encoding increases file size by approximately 33%, so it's important to consider file size when working with large PDF documents.
Converting PDFs to Base64 and vice versa can be done using various methods. Here are the most common approaches:
Convert PDF to Base64 using FileReader:
// PDF to Base64
const fileInput = document.querySelector('input[type="file"]');
const reader = new FileReader();
reader.onload = (e) => {
const base64 = e.target.result;
// base64 contains: "data:application/pdf;base64,JVBERi0..."
console.log(base64);
};
reader.readAsDataURL(fileInput.files[0]);
// Base64 to PDF
const base64String = 'data:application/pdf;base64,JVBERi0...';
const link = document.createElement('a');
link.href = base64String;
link.download = 'document.pdf';
link.click();Use base64 module to encode/decode PDFs:
import base64
# PDF to Base64
with open('document.pdf', 'rb') as pdf_file:
encoded_string = base64.b64encode(
pdf_file.read()
).decode('utf-8')
print(encoded_string)
# Base64 to PDF
decoded_data = base64.b64decode(encoded_string)
with open('decoded_document.pdf', 'wb') as pdf_file:
pdf_file.write(decoded_data)Use Base64 PDFs directly in HTML or JSON:
<!-- Embed PDF in HTML iframe -->
<iframe src="data:application/pdf;base64,JVBERi0..."
width="100%"
height="600px">
</iframe>
<!-- In JSON API -->
{
"document": "data:application/pdf;base64,JVBERi0...",
"filename": "document.pdf"
}
<!-- Download link -->
<a href="data:application/pdf;base64,JVBERi0..."
download="document.pdf">
Download PDF
</a>Our PDF Base64 encoder and decoder tool makes it incredibly easy to convert PDFs to Base64 and vice versa. Follow these simple steps:
Select the Encode tab to convert a PDF to Base64, or the Decode tab to convert a Base64 string back to a PDF.
For encoding, click the upload area and select a PDF file (up to 10MB). Then click the Encode button. For decoding, paste your Base64 string in the input field and click the Decode button.
Click the Copy to Clipboard button to copy the Base64 string to your clipboard. For decoded PDFs, click the Download PDF button to save the PDF file to your device.
Paste the Base64 string into your HTML, JSON, or code. For HTML, use it in an iframe tag with data:application/pdf;base64, prefix, or in a download link. For JSON APIs, include it as a string value.
Discover more free tools to boost your productivity
Box
Create beautiful box shadow with our free box shadow css generator. Generate custom box shadow css with 60+ preset effects, live preview & instant Tailwind and CSS box shadow code.
Gradient
Create beautiful gradient background using tailwind CSS Gradient Generator. Use 90+ presets to generate customized tailwind, CSS gradient background code quickly with live preview.
HEX: #ff5733
RGB: 255, 87, 51
HEX: #4a90e2
RGB: 74, 144, 226
Convert HEX color codes to RGB values instantly with our free HEX to RGB converter. Learn how HEX to RGB conversion works, understand color formats, and get accurate RGB values for web development.
Blog Post
Transform your content...
Social Post
Transform any blog post into engaging, platform-optimized content using our Blog to Social Media Post Generator. Powered by AI to maintain your message while adapting tone and style.
Subscribe to FrontendGeek Hub for frontend interview preparation, interview experiences, curated resources and roadmaps.
All in One Preparation Hub to Ace Frontend Interviews. Master JavaScript, React, System Design, and more with curated resources.
© 2026 FrontendGeek. All rights reserved