PDF to Base64
Get a PDF as a base64 data URL for code.
PDF to Base64 converts a PDF file into a base64-encoded data URL string that you can paste directly into code, such as embedding a small PDF inline in an app or API payload.
Click to choose a PDF, or drag one in here
One file at a time
How to use
- Upload a PDF file.
- Copy the resulting base64 data URL, or download it as a text file.
Common use scenarios
- Embedding a small PDF directly into JSON, HTML, or a config file without hosting a separate file.
- Passing a PDF as inline data to an API that expects a base64-encoded document.
- Quickly generating a data URL for testing a PDF-handling feature in code.
- Storing a small PDF as text alongside other data in a database field.
✓Content & verification reviewed: 2026-09-17
How we verify PDF to Base64
How to confirm the encoded string is correct and usable.
Base64 text is noticeably larger than the file
Base64 encoding adds about 33% overhead — a 1 MB PDF becomes roughly 1.33 MB of text, so this isn't a good approach for large files.
The result is a complete, pasteable data URL
The output includes the "data:application/pdf;base64," prefix, so it's ready to use directly as a source value without further editing.
Everything happens locally
The file is read and encoded entirely in your browser — nothing is uploaded anywhere in the process.
Before you rely on the result
- Your PDF is small enough that a ~33% size increase as text is still practical.
- You've copied the complete data URL, including the "data:application/pdf;base64," prefix.
- You've tested the resulting string works correctly wherever you're using it.
Who this is for
- Developers who need to embed a small PDF directly into code or config.
- Anyone passing a PDF as inline data to an API.
- People testing a PDF-handling feature that expects base64 input.
Real-world examples
Embedding a PDF in a config file
A small terms-of-service PDF needs to ship inline with an app's configuration rather than as a separate hosted file — converting it to base64 makes that possible.
Testing an API integration
A developer needs a quick base64-encoded PDF to test an endpoint that accepts documents as inline data, without setting up file hosting.
Limitations
- Base64 text is about 33% larger than the original file — avoid this for very large PDFs.
Frequently asked questions
Is base64 a good way to store large PDFs?
No — the roughly 33% size increase makes it impractical for large files; it's best suited to small documents.
What does the output string look like?
A complete data URL starting with "data:application/pdf;base64," followed by the encoded content, ready to paste directly into code.
Is my PDF uploaded anywhere during conversion?
No — the file is read and encoded entirely in your browser.
🔒 Runs in your browser — nothing is uploaded. Results are for reference only; see the disclaimer. Last updated: 2026-09-17
Subscribe for updates
New tools and tips, straight to your inbox. No spam, unsubscribe anytime.