PDF to Base64 Converter
Need to send a PDF through a web service, store it in a database or embed it in a web page? Encode it as Base64 in one step. Choose plain Base64 or a ready-made data URI, wrap lines if your system needs it, and copy or download the result.
or choose a source below
How to Convert a PDF to Base64
Quick answer: drop your PDF in, choose Base64 only or Data URI, tick line wrapping if needed, then press Copy to Clipboard or Download .txt.
-
1
Add your PDF
Drop the file. It is encoded straight away.
-
2
Choose the format
Base64 only, or a data URI that starts with data:application/pdf;base64,
-
3
Wrap lines if needed
Tick wrapping for systems that expect 76-character lines, such as email.
-
4
Copy or save
Copy the full string or download it as a .txt file.
What You Get
What Is Base64?
Base64 is a way of writing any file, including a PDF, using only letters, numbers and a few symbols. Computers use it to send files through systems that are designed for text, such as web services, XML messages, email bodies, configuration files and databases. The PDF itself does not change; it is simply written in a text-friendly form, and the receiving system turns it back into the same file.
Base64 makes data about one third larger than the original, so a 3 MB PDF becomes roughly 4 MB of text. The summary shows the exact size increase for your file.
Base64 or Data URI?
Base64 only gives the raw encoded string. Use it for web services and databases that ask for a "base64" field, for example when sending invoices, signed documents or attachments to a web service. Data URI adds data:application/pdf;base64, at the start, so the string can be used directly as a link or embedded in HTML, which some browsers and apps can open as a PDF.
Wrap lines at 76 characters breaks the string into short lines, the format used in email (MIME) and some older systems. Leave it off for web services and JSON, which expect one continuous string.
Large Files
Very long strings can slow down a browser text box, so for large PDFs the middle panel shows the start of the result and tells you how many more characters there are. Copy to Clipboard and Download .txt always give you the complete string. Files up to 50 MB are supported, which covers almost every document used with web services and email systems.
Example: Sending a PDF to an Online Service
An accounting web service asks for invoices as a Base64 field in a JSON request. Drop the invoice PDF in, keep Base64 only and leave wrapping off, then press Copy to Clipboard and paste the string into your request body as the value of the field. When the service decodes it, it receives the identical PDF, byte for byte.
Who Uses PDF to Base64?
Developers and testers prepare sample payloads for web services and automated tests. Integration and support teams debug document uploads, low-code builders store PDFs in database fields, and email template designers embed small PDFs in messages. Because encoding happens in your browser, it is safe to use with real documents rather than dummy files.
Tip: before sending a large document to an online service, check its size limit. Base64 adds about a third to the size, so a 9 MB PDF becomes roughly 12 MB of text. Compressing the PDF first keeps requests fast and avoids rejected uploads.
Everything is encoded on your device, so you can safely encode contracts, invoices and other private documents without them ever being sent to our servers.
Related Tools
To turn a Base64 string back into a PDF, use Base64 to PDF. If your PDF is too big for an upload limit, compress it first. For working with JSON payloads, the JSON Formatter helps you check your request. Everything runs in your browser.
PDF to Base64: Sending Documents Through Text-Only Channels
APIs, JSON files and some databases cannot carry raw binary, so documents are written as Base64 text. A PDF becomes a long string that starts with JVBERi0.
What to know
The string is about 33 percent longer than the file. Most services have limits on request size, so large PDFs may need to be compressed first with compress PDF. Base64 is not encryption, so anyone with the string can rebuild the file.
To rebuild a PDF, use Base64 to PDF.
Frequently Asked Questions
Questions about converting PDF to Base64