Base64 to PDF Converter
Turn a Base64-encoded PDF from an API or a database back into a document you can read and save.
Decode Base64 to PDF Online
Many APIs cannot send a file on its own, so they wrap it in JSON as one long Base64 string: shipping labels, invoices, bank statements and generated reports arrive this way. So do PDFs stored in database columns and email sources. This page is the Base64 Encoder and Decoder set to decode as you paste, with a PDF viewer for the result.
The decoding runs locally in your browser, and the preview uses the browser's own PDF viewer, so the document is never uploaded.
Recognising a Base64 PDF
Every PDF begins with the bytes %PDF-, which become JVBERi0 in Base64. If a string in an API response starts with those seven characters, it is a PDF. A string starting with data:application/pdf;base64, is the same thing with a label in front, and the tool strips that label for you.
Common problems
- Escaped slashes: JSON may show
\/instead of/. Copy the value from a parsed response, or replace\/with/first. - Quotes copied along: the surrounding
"characters are not part of Base64 and make the string invalid. - Base64URL: strings that use
-and_are converted automatically. - No viewer appears: the data is not a PDF. The tool still offers the file as a download, named after the type it detects.
Doing it in code
| Platform | Decode to a file |
|---|---|
| Linux / macOS | base64 -d in.txt > out.pdf |
| PowerShell | [IO.File]::WriteAllBytes('out.pdf', [Convert]::FromBase64String($s)) |
| Python | open('out.pdf', 'wb').write(base64.b64decode(s)) |
| Node.js | fs.writeFileSync('out.pdf', Buffer.from(s, 'base64')) |
For other file types, Base64 Decode handles text, images and any binary data. To build a PDF from pictures, use Image to PDF.