Base64 to PDF Converter
Got a long Base64 string from a web service, a database or an email source and need the PDF it contains? Paste it here, see a preview of the first page to confirm it is the right document, and download the PDF.
How to Convert Base64 to PDF
Quick answer: paste the Base64 text or data URI into the box on the right, press Decode, check the preview and press Download PDF.
-
1
Paste the Base64
Paste the string or data URI into the box, or open a .txt file that contains it.
-
2
Decode
Press Decode. The text is checked to make sure it is a real PDF.
-
3
Check the preview
The first page appears in the middle so you can confirm it is the right document.
-
4
Download
Name the file and press Download PDF.
What You Get
Turning Base64 Back Into a PDF
Systems that exchange documents as text, such as web web services, databases, logs and email sources, often store PDFs as Base64. When you need to look at one of those documents, you have a long block of letters and numbers instead of a file. Decoding it rebuilds the original PDF exactly, byte for byte, so you can open, save or forward it like any other PDF.
What You Can Paste
Paste plain Base64, or a data URI that starts with data:application/pdf;base64,; the prefix is removed automatically. Line breaks, spaces and quotation marks from JSON or code are ignored, and URL-safe Base64 using - and _ is converted for you. For very long strings that are hard to copy, save them in a .txt file and use Open .txt File.
After decoding, the tool checks that the data really starts like a PDF. If it decodes to something else, such as an image or a ZIP file, you are told straight away instead of downloading a broken file.
Preview Before Downloading
The first page of the decoded PDF is shown in the middle, together with the number of pages and the file size, so you can confirm you have the right document before saving it. If the PDF is password protected, it can still be downloaded, but it cannot be previewed without the password. Give the file a sensible name in PDF File Name, then press Download PDF.
Example: Checking a Web Service Response
A web service returns invoices in JSON as a field called "document". Copy the field's value, quotes and all, and paste it into the box. Press Decode: the tool strips the quotes, checks the data and shows the invoice's first page. Download it to keep a copy, or compare it with what your app displays to find a bug.
Who Decodes Base64 PDFs?
Developers inspect web service responses and test fixtures. Support and operations teams retrieve documents stored in databases or logs, integration specialists check what an external system sent, and anyone who receives a document as a long text block in an email source can turn it back into a PDF. Because decoding happens in your browser, sensitive documents never touch a server.
Tip: if the string was copied from a log or a long line in a text editor, make sure nothing was cut off at the end. A complete Base64 PDF usually ends with one or two = signs or letters, and the decoded file must start with %PDF. The size shown after decoding helps you confirm you have the whole document.
The PDF is rebuilt on your own device, so private documents such as contracts and invoices never pass through our servers while you check them.
Related Tools
To go the other way, use PDF to Base64. To read the decoded document's text, try PDF to Text, and to view its pages as images, PDF to JPG. For tidying the JSON your string came from, use the JSON Formatter.
Opening a PDF Hidden in Base64
Web services often return documents as Base64 inside JSON, because JSON cannot carry raw binary. If you have such a string and need the actual PDF, decoding rebuilds it.
How to recognise a PDF
Every PDF begins with the bytes %PDF, which in Base64 look like JVBERi0. If your string starts differently, it is probably another file type or has a data URL prefix such as data:application/pdf;base64, that should be removed first.
After decoding
Open the PDF to check the page count and text. If it appears blank or damaged, the string may be truncated. For the opposite job, see PDF to Base64.
Frequently Asked Questions
Questions about converting Base64 to PDF