Encode a PDF as Base64
Select a PDF and generate raw Base64, a complete PDF data URL, formatted JSON or a JavaScript download snippet. The encoding preserves the original PDF bytes so the result can be decoded back to the same file.
Convert a PDF file into raw Base64, a reusable data URL, JSON or JavaScript directly in your browser. Your document never leaves your device.
Choose a PDF to generate raw Base64, a data URL, JSON or JavaScript output for development workflows.
Select a PDF and generate raw Base64, a complete PDF data URL, formatted JSON or a JavaScript download snippet. The encoding preserves the original PDF bytes so the result can be decoded back to the same file.
The browser reads the selected PDF with local file APIs and converts its bytes directly. No backend endpoint, temporary upload or cloud storage is required for the encoding workflow.
Base64 normally adds roughly one third to the original binary size. The result panel shows source and encoded sizes so you can judge whether Base64 is suitable for an API payload, inline resource or storage format.
Raw Base64 is usually best when an API already defines the MIME type separately. A data URL adds the data:application/pdf;base64, prefix and is convenient for browser previews. JSON and JavaScript outputs add reusable wrappers for common development workflows.
PDF-to-Base64 encoding is useful when a system expects binary documents inside a text-only transport such as JSON, when you need an inline browser data URL, or when you are testing a document API and want a copyable representation of a PDF. Base64 does not make the document smaller and is usually less efficient than transferring the original PDF when normal binary uploads are available.
To reverse the process, open Base64 to PDF. If your goal is to convert pages to images, merge documents, split pages or reduce file size, use the broader PDF Tools collection instead.
No. Base64 is an encoding format, not compression. The encoded text is normally about one third larger than the original PDF binary.
Use raw Base64 when a receiving system already knows the file type, a data URL for browser-oriented workflows, JSON for structured API payloads and JavaScript for reusable browser code.
Yes. The tool encodes the original bytes without opening or editing the document, so existing password protection remains part of the PDF data.
No. The PDF is read and encoded locally in your browser. The file does not need to be uploaded to a conversion server to generate the Base64 output.
Decode Base64 back to PDF or use another browser-based PDF workflow.
Encoding a PDF as Base64 does not change the PDF document itself. It converts the file bytes into text so the payload can be copied into JSON, JavaScript, APIs or other text-only transports. Decoding that Base64 again should reproduce the same PDF bytes.
The encoded string is larger than the source PDF because Base64 uses four characters for each three-byte group. For large documents this overhead matters, so direct file upload or binary transport is usually more efficient when an API does not specifically require Base64.
These links connect the current task with the closest reverse, inspection or format-specific workflow.
Decode the generated text back into a PDF and validate the resulting document bytes.
Inspect a generated or received PDF Base64 payload without uploading it.
Convert or reorganize the PDF before encoding if the document still needs editing.