How to convert Base64 to PDF
- Paste the Base64 string into the box above. It may come with a
data:application/pdf;base64,prefix or without one. - The decoder checks the first bytes. A real PDF starts with
%PDF, which isJVBERiin Base64. When it finds that signature, the label shows PDF document and the Preview tab opens the file in a viewer. - Click Download file to save it as
decoded.pdf.
The PDF is rebuilt in your browser and never uploaded. That matters for invoices, contracts, statements and other documents you would rather not send to a stranger's server.
Where Base64 PDFs come from
- APIs for invoicing, e-signature, shipping labels and reporting often return the document as a Base64 field inside JSON.
- Email attachments are stored as Base64 in the raw message source, between MIME boundary lines.
- Databases and logs sometimes store small files as Base64 text.
- Browser code that generates PDFs may hand you a data URI.
If you have a JSON response, copy only the value of the field, without the surrounding quotes.
Check that a Base64 string is a PDF
Look at the start of the string. PDF data in Base64 almost always begins with JVBERi0, which decodes to %PDF-. If your string starts with something else, it is probably not a PDF:
| Base64 starts with | It is probably |
|---|---|
JVBERi0 |
PDF document |
UEsDB |
ZIP archive (also DOCX, XLSX) |
iVBORw0KGgo |
PNG image, see Base64 to Image |
H4sI |
GZIP-compressed data |
The decoder does this check for you and shows the result in the label above the output.
Why a Base64 PDF will not open
The string is truncated. PDFs are large, and a Base64 PDF can run to hundreds of thousands of characters. Log viewers and some terminals cut long lines. A truncated PDF either fails to open or opens with missing pages. Copy the value from the original source.
JSON escaping. Some systems escape / as \/ inside JSON. Those backslashes are not Base64. Remove them, or parse the JSON first and copy the clean value.
It is compressed or encrypted first. If the label says GZIP data or Binary data, the PDF was wrapped before encoding. Save the file and unpack it with the right tool.
The viewer is blocked. Some browsers do not show PDFs inside a page. Download the file and open it in your PDF reader instead.
Base64 PDF size
Base64 adds about a third to the size, so a 300 KB PDF arrives as roughly 400 KB of text. The info line under the result shows the decoded size in bytes, which is the size of the file you will download.
For images, use Base64 to Image. For any other string, go back to the Base64 decoder.
Last updated: