How to convert Base64 to a PDF
- Paste the Base64 string into the left box. A full
data:application/pdf;base64,...URI works too. A small sample PDF is already loaded so you can see the result. - Check the status line. It should say it found a PDF file and show the size. If it says the data is text or another type, the string is not a PDF.
- Click Download. The file is saved as
decoded.pdfand opens in any PDF reader.
To go the other way, choose a PDF in the Base64 encoder and copy the output.
How to recognise a Base64 PDF
Every PDF file starts with the bytes %PDF- followed by a version number. In Base64, those bytes become JVBERi0. So if a long string from an API starts with JVBERi0, you are almost certainly looking at a PDF. The sample in the tool starts that way: decode it and you get a one-page PDF that says "Hello from base64encode.app".
| Base64 starts with | File type |
|---|---|
JVBERi0 |
|
iVBORw0KGgo |
PNG image |
/9j/ |
JPEG image |
UEsDB |
ZIP (also DOCX, XLSX) |
Where Base64 PDFs come from
PDFs often travel as Base64 because the systems in between only carry text:
- APIs that generate documents, such as invoice, shipping label and e-signature services, often return the file as a Base64 field inside a JSON response.
- Email attachments are stored as Base64 in the raw message source.
- Web apps sometimes keep a PDF in a
data:application/pdf;base64,URI to show it in an<iframe>or offer it for download.
In each case, the Base64 text is the whole file. Nothing is compressed or encrypted on top, so decoding gives you back the exact original.
Fixing a Base64 PDF that will not open
- The string is cut off. Long strings get truncated in log viewers, terminals and chat apps. If the decoder reports an invalid length, or the PDF opens with an error about a damaged file, copy the field again from the raw response.
- There are extra characters. Remove the JSON quotes around the value and any escaped slashes (
\/). Line breaks and spaces are ignored automatically. - It is not a PDF. If the status line names another type, such as ZIP, the API sent a different file. Download it and open it with the right program.
- It decodes to text. Some APIs encode the Base64 twice. If the decoded output is itself a string starting with
JVBERi0, copy it and decode it again.
Is it safe for private documents?
The conversion runs entirely in your browser using JavaScript. The PDF is not uploaded, stored or logged, so you can decode invoices, contracts or ID scans here. For other kinds of encoded files, use the general Base64 decoder.