Base64 to PDF

Free Base64 to PDF converter — paste a Base64 string or a data URI, read the document here, and download the original file back.

Built-In Viewer
Signature Verified
Nothing Leaves Your Device
Base64 String
Ctrl + Enter to convert

A bare string and a full data URI both work. Quotes, src= wrappers, line breaks, URL-safe - and _, and missing = padding are all repaired for you.

PDF Preview

Your PDF appears here

Paste a string and press Convert

Format
Pages
File Size
Base64 Chars
Download PDF

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

How to convert Base64 to PDF online

Paste the string in, press the button, read the document. The whole decode base64 to pdf online step happens inside this page, so there is no upload wait and no copy of your document sitting on somebody else's server — a base64 to pdf converter free of accounts, queues and daily caps. Three steps:

  1. Paste the string. A bare base64 string to pdf online conversion works, and so does a full data URI starting data:application/pdf;base64,. Sample loads a real base64 pdf sample if you want to see the tool work first.
  2. Press Convert. The bytes are decoded and the document opens in the viewer, with its PDF version, page count and file size beside it. That is the whole job of a base64 to pdf decoder online: no settings to get wrong.
  3. Read, download or embed. Download completes the decode base64 to pdf file online round trip and saves it as document.pdf, Open in new tab gives you a full-window view, and the copy buttons hand you a data URI, an <embed> or an <iframe>.

It checks that the file really is a PDF

Every PDF begins with the five characters %PDF- followed by a version number. That is the base64 pdf header, and it is not optional — a file without it is not a PDF, whatever its name says.

This matters more than it sounds. The single 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 anyway, and what you have is an HTML file wearing a PDF's clothes. Encode that and you get perfectly valid Base64 containing no PDF at all. This page checks the signature and tells you what the bytes really are — HTML, a ZIP, an image, or plain text — instead of handing you a document that refuses to open.

Base64 starts withWhat it really is
JVBERi0PDF — the encoded form of %PDF-
PCF or PGh0bWwAn HTML page — usually a failed download
UEsDBA ZIP, which includes .docx and .xlsx
0M8R4An old .doc or .xls
iVBORw0KGgo or /9j/A PNG or JPEG image

Worth knowing on its own: a base64 encoded pdf sample always opens with JVBERi0, so you can tell a PDF string from any other at a glance, before decoding a single byte.

Reading a PDF without downloading it

Often nobody wants the file — they want to know what is in it. A string arrives from an API, a webhook or a database column and the only question is whether it is the invoice it claims to be. That makes this a base64 pdf viewer first and a converter second: the base64 to pdf preview online appears the moment you press Convert, and nothing touches your disk unless you ask for it.

The viewer is your browser's own PDF reader, so scrolling, zooming, searching and printing all work exactly as they normally do. The page count and file size beside it answer the question a filename cannot: whether you have the full document or a truncated fragment. Used as a base64 pdf validator, that takes about two seconds.

Displaying a Base64 PDF in HTML

To handle base64 pdf display in html, put the data URI inside an <embed> or an <iframe>. That is all there is to base64 to pdf html embedding. The copy buttons write both, already complete, which covers the usual base64 pdf viewer in html case:

  • Embed<embed src="data:application/pdf;base64,JVBERi0…" type="application/pdf" width="100%" height="600">
  • Iframe<iframe src="data:application/pdf;base64,…" width="100%" height="600"></iframe>
  • Link<a href="data:application/pdf;base64,…" download>Download</a>

One honest warning, because it catches people out: inline PDF data URIs are not reliable. Chrome blocks top-level navigation to them, most mobile browsers refuse to render a PDF inside a page at all, and a document of any real size makes the HTML enormous — the base64 pdf mime type being correct does not change any of that. For anything beyond a small demo, serve the PDF as a file and link to it.

This decodes a PDF — it does not create one

Worth saying plainly, because the searches suggest people arrive expecting otherwise. If you are looking for base64 text to pdf in the sense of turning a sentence into a document, this is not that tool: it is a base64 to pdf online converter for a PDF that already exists and was encoded. Paste Base64 that decodes to plain text and the page says so rather than handing you an empty document. The same goes for base64 encode to pdf online — encoding runs the other way, and Encode to Base64 is the tool for it. Some people write the name as base64 2 pdf or look for a base64 to pdf generator; it is all the same operation, and it is decoding.

Why a string sometimes will not decode

Base64 is strict about length: it comes in blocks of four characters, so one missing character breaks the tail. The usual causes are a copy that stopped short, a line-wrapped string that lost its ends, or stray characters picked up from the surrounding code. The harmless cases are repaired here automatically — surrounding quotes, src= prefixes, whitespace, URL-safe - and _, and missing = padding — and anything else gets a specific explanation rather than a generic failure.

A half-copied string is the other common case, and it is sneakier, because it does not fail: it still starts with %PDF-, still decodes, and a lenient viewer will happily show part of it. Every PDF ends with an %%EOF marker, so this page checks for it and tells you the string is cut short rather than letting you download a document that no reader will open.

A blank preview with a working download is a different problem again, and almost always an encrypted file: a password-protected PDF decodes perfectly and then declines to display. The page detects that too, so you are not left debugging a tool that is working fine.

What Base64 costs, and what it does not

Decoding is lossless. Base64 is an encoding rather than a compression, so the document you download is byte-for-byte the file that was encoded — signatures, embedded fonts and form fields all survive, because nothing is re-rendered. What it costs is size: four characters for every three bytes, so the base64 pdf size is always about 33% larger than the file it carries. The Base64 Chars and File Size figures above show both numbers together.

To go the other way, or to work on the document afterwards, there is Encode to Base64, PDF Splitter and PDF to Images. The full explanation of what Base64 is, and why it is not encryption, is in What Is Base64? And Why It Is Not Encryption.

Frequently Asked Questions

Paste the Base64 string into the box and press Convert. It is decoded in your browser, the PDF opens in the viewer on the right, and Download saves it as document.pdf. A bare Base64 string works, and so does a full data URI beginning data:application/pdf;base64,
Because the decoded bytes do not begin with %PDF-, which every real PDF does. This happens more often than people expect: a failed download saves the website's error page under a .pdf name, and encoding that gives you valid Base64 containing HTML. The tool names what the bytes really are, whether that is HTML, a ZIP, an image or plain text.
No. This decodes a PDF that already exists and was encoded as Base64; it does not create a document from scratch. If your Base64 decodes to plain text rather than to a PDF file, the tool says so instead of producing an empty document.
Yes, byte for byte. Base64 is an encoding rather than a compression, so decoding returns exactly the bytes that were encoded. Nothing is re-rendered, re-compressed or altered, which means signatures and embedded fonts survive intact.
Use a data URI inside an embed or iframe element: <embed src="data:application/pdf;base64,JVBERi0…" type="application/pdf" width="100%" height="600">. The Copy as embed and Copy as iframe buttons build both for you. Be aware that some browsers and most mobile ones refuse to render PDFs inline this way and offer a download instead.
Usually because the PDF is password-protected — the page warns you when it detects encryption. The other common cause is a browser or extension that blocks inline PDF viewing. In both cases the file itself is fine, so downloading it and opening it in a normal PDF reader works.
This page accepts up to about 24 MB of Base64 text, which is roughly an 18 MB PDF. The format itself has no limit; the practical ones come from whatever carries the string, such as a URL length cap or a database column.
No. The string is decoded by your own browser and the document is held in memory in this tab, which is also what the viewer reads from. Nothing is uploaded, nothing is stored, and closing the tab discards everything.