Decoding Base64 back into a PDF
APIs, emails and databases often carry PDFs as Base64 text. Paste that text here and the tool decodes it in your browser, checks it really is a PDF, shows a preview and lets you download the file.
Accepted input
- Raw Base64, typically starting with JVBERi0 (the encoded form of %PDF-).
- A data URL such as data:application/pdf;base64,JVBERi0… — the prefix up to the comma is removed automatically.
Where Base64 PDFs come from
- JSON API responses that return invoices, labels or reports in a field like "document" or "pdf_base64".
- Email source (MIME) where an attachment is encoded under Content-Transfer-Encoding: base64.
- Database columns and logs that store documents as text.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Invalid Base64 | Quotes, a trailing comma or JSON escapes (\n, \/) copied with the value | Copy only the characters between the quotes; remove \n and replace \/ with / |
| Decodes but is not a PDF | The data is a different file type (PNG, ZIP) or is still encrypted/compressed by the API | Check the API documentation for the real content type |
| PDF opens blank or truncated | The string was cut off by a log or console length limit | Fetch the full value again from the source |
| URL-safe Base64 (uses - and _) | Variant used in URLs and JWTs | Replace - with + and _ with / before pasting |
Privacy
Decoding uses the browser's built-in atob function. The Base64 text and the resulting PDF never leave your device, which matters because these strings often contain invoices or identity documents.
