PDF to Base64

Free PDF to Base64 converter — drop a document in and get the encoded string, a data URI, an embed tag or a download link.

Four Output Formats
Signature Verified
Nothing Leaves Your Device
PDF File

The file is read on this page. It is checked for a real %PDF- signature first, so a document that is not actually a PDF is caught before you encode it.

Format
Pages
File Size
Base64 Chars
Base64 Output

Your Base64 appears here

Drop a PDF on the left to start

No sign-up, no watermark, no limit on how many you convert.

How to convert a PDF to Base64 online

Drop the document in and the encoded text is there. The whole conversion runs on this page, so there is no upload wait and no copy of your file sitting on somebody else's server — a PDF to Base64 converter online that never sees the document. Three steps:

  1. Add the file. Drop the document in or click to browse. This PDF file to Base64 reader takes it straight away — the PDF to Base64 encoder runs the moment the file lands. One document at a time, up to 20 MB.
  2. Pick the output. The raw string, a data URI, an <embed> tag or a ready-made download link. Whatever you need to paste into next.
  3. Copy or save. Copy the text, or save it as a .txt file when it is too long to hold on the clipboard comfortably.

Four ways to take the result away

A PDF to Base64 string on its own is rarely the finished job — it is almost always about to be pasted into something. So rather than make you convert PDF to Base64 string online and then reshape it by hand, these are the shapes it offers:

OutputLooks likeUse it for
Raw stringJVBERi0xLjQK…JSON payloads, database columns, an API field
Data URIdata:application/pdf;base64,JVBERi0…Anywhere a URL is expected
<embed> tag<embed src="data:application/pdf;base64,…">Showing the document inside a page
Download link<a href="data:…" download>Offering the file without hosting it

That data:application/pdf;base64, opening is the PDF base64 prefix — the part that tells whatever reads it what kind of file follows. The string itself always begins JVBERi0, which is simply %PDF- encoded, and that is the PDF base64 header you can recognise at a glance. Any PDF base64 sample you find anywhere begins the same way.

It checks the file is really a PDF first

Encoding is indiscriminate: hand it any file and it produces valid Base64. That is exactly the problem. The most common cause of a “corrupt PDF” is a download that failed — the server returned an error page, the browser saved it under the .pdf name, and the result is an HTML file wearing a PDF's clothes. Encode that and the fault is now invisible, sitting inside a perfectly valid-looking string.

So the signature is checked before anything is encoded. If the bytes do not start with %PDF-, the page says what they actually are — HTML, a ZIP, a Word file, an image — rather than handing you a string that will fail somewhere further down the line. A second check catches a PDF that was cut short mid-download, because a complete one always ends with an %%EOF marker.

Why the output is a third bigger

Every three bytes become four characters, so the encoded text is roughly 33% larger than the document. That is the whole story behind PDF to Base64 size increase: it is arithmetic, not a setting, and no tool can avoid it. A 1 MB PDF becomes about 1.37 MB of text, so a PDF in Base64 always weighs more than the file it came from. Turning a PDF into Base64 makes it portable, not smaller.

Base64 is an encoding rather than a compression, so nothing is squeezed and nothing is lost. Decoding gives back a byte-for-byte identical file — signatures, embedded fonts and form fields all intact, because the document is never re-rendered. The File Size and Base64 Chars figures above show both numbers side by side.

The 76-character wrap, and when you need it

MIME — the standard behind email attachments — wraps encoded data at 76 characters per line, and some mail servers still reject a message containing longer lines. If the string is going into an email, turn the wrap on. If it is going into a data URI, a JSON field or an HTML attribute, leave it off: those need one unbroken line, and the line breaks would have to be stripped again anyway.

Going the other way

Searches for PDF from base64 online, PDF base64 decode online or PDF base 64 decode are asking for the opposite operation, which is a separate page: Base64 to PDF takes a string, checks it, and works as a PDF base64 viewer — the document opens in a reader before you download anything. Between the two, both directions are covered.

For other kinds of file there is Image to Base64 and Encode to Base64 for plain text. If the aim is a smaller document rather than an encoded one, a PDF Splitter will do more good than any encoder. And the full explanation of what Base64 is — including why it is not encryption — is in What Is Base64? And Why It Is Not Encryption.

Frequently Asked Questions

Drop the PDF onto the box or click to browse. It is read and encoded by your own browser, and the Base64 appears immediately. Choose the raw string, a data URI, an embed tag or a download link, then copy it or save it as a text file.
Because Base64 writes three bytes as four characters, so the output is always about 33% larger than the file. That growth is the price of turning binary into text that can travel through email, JSON or a URL. It is not compression and never makes anything smaller.
No. The file is read with a FileReader and encoded in this page, so it never leaves your device. Nothing is uploaded, nothing is stored, and closing the tab discards everything.
Because the bytes do not begin with %PDF-, which every real PDF does. The most common cause is a download that failed: the server returned an error page and the browser saved it under the .pdf name. The tool names what the file really is, whether that is HTML, a ZIP, a Word document or an image.
data:application/pdf;base64, followed by the encoded string. Every Base64 PDF also starts JVBERi0, which is the encoded form of %PDF- — so you can recognise one at a glance without decoding it.
Email. The MIME standard wraps encoded attachments at 76 characters per line, and some mail servers still reject a message with lines longer than that. Leave it off for a data URI or for JSON, where the string has to stay on one line.
No. Base64 is an encoding, not a compression, and it is lossless in both directions. Decoding the string gives back a byte-for-byte identical file, so signatures, embedded fonts and form fields all survive.
Yes, with the Base64 to PDF tool, which decodes the string and shows the document in a viewer before you download it. The two tools are the same operation in opposite directions.