PDF to Base64 Encoder — Data URI / JSON Payload

Encode a PDF file to Base64 in your browser — for data URIs, JSON payloads and API requests. No upload, no signup. No upload — runs 100% in your browser

Drop your PDF here
or click to browse
100% private: the file is processed in your browser and never uploaded anywhere.

How to use this tool

  1. Drop a PDF onto the box.
  2. The file is read and encoded locally — nothing leaves your device.
  3. Copy the Base64 string or download it as a .txt file.

What Base64 is for

Base64 is how binary data travels through channels that only understand text. Embedding a PDF in a JSON API payload, building a data: URI so a viewer opens the file inline, passing an attachment to a system that expects a string field — all of those need the file's bytes expressed as safe text characters. This page encodes your PDF locally and hands you the string, with or without the data:application/pdf;base64, prefix depending on where it is headed.

The 33% rule

Base64 packs 3 bytes into 4 characters, so the output is always roughly a third larger than the input. There is no compression and no way around it — the number shown in the result line is the honest size your payload will be. For files that will be sent repeatedly, upload the binary once and reference it; reserve Base64 for genuinely inline uses.

Frequently Asked Questions

Are my files uploaded to a server?

No. Everything on this page runs inside your browser using JavaScript and WebAssembly. Your file never leaves your device — you can even disconnect from the internet after the page loads and the tool still works.

Why is the Base64 bigger than my PDF?

Base64 stores 3 bytes of binary in 4 characters of text, so output is about 33% larger than the input. That is inherent to the encoding, not a setting.

What is the data: URI prefix for?

It turns the Base64 into a string you can paste directly into an HTML href, CSS url() or JSON field — anything that expects an inline file reference instead of a separate upload.

Is there a size limit?

No hard limit — encoding happens in your browser's memory. Files of tens of MB encode fine; the output textarea with a copy button is the practical interface for large results.

Related Tools

JPG to PDF ConverterPNG to PDF ConverterPDF to JPG ConverterPDF to PNG ConverterMerge PDFSplit PDFPDF to TextPDF to Markdown ConverterPDF to HTML ConverterHEIC to PDF Converter