How to Convert Base64 to PDF
A PDF in Base64 almost always starts with the letters JVBERi0, which is how the bytes %PDF- look after encoding. Paste the string, and the tool turns the characters back into bytes, checks the PDF header and shows the document. The sample file in the tool starts like this:
JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAw...Decoded, the full 800 characters give a 599 byte file, and the tool reports it as "PDF 1.4, 599 bytes, about 1 page".
Base64 Decode to PDF: What You Can Paste
- Bare Base64, with or without line breaks every 64 or 76 characters.
- A data URI such as
data:application/pdf;base64,JVBERi0..., or an<embed>or<iframe>tag that contains one. - A JSON value in quotes, including escapes such as
\/and\n. - A whole JSON object or array. The tool uses the longest text value in it and tells you which field that was.
- URL-safe Base64 that uses
-and_, with or without the=padding, and percent escapes such as%2B.
When the tool fixes something to read the text, such as removing a prefix or adding missing padding, it lists the fix under the preview.
Why a Base64 String Does Not Open as a PDF
- The text is cut off. A length that leaves one character over is not valid Base64, and a PDF without its
%%EOFend marker is flagged. - The text has a character that is not Base64, such as
$. The tool shows the character and its position, for example: The text contains "$" at position 8. - The data is a different file.
iVBORw0KGgo=decodes to a PNG image, not a PDF. For images, use Base64 to Image. For text, use Base64 Decode. - Two strings were joined, so an
=sign sits in the middle.
Display a Base64 PDF in HTML
A browser can show a PDF from a data URI inside an <iframe> or <embed> tag:
<iframe src="data:application/pdf;base64,JVBERi0xLjQK..." width="100%" height="600" title="invoice.pdf"></iframe>To make the Base64 from a file, use PDF to Base64. It can also give you this snippet ready to paste.
Decode a Base64 PDF in Your Own Code
To check your own code against this tool, the steps are the same in any language: strip any prefix, decode, write the bytes to a file.
import base64
with open("out.pdf", "wb") as f:
f.write(base64.b64decode(b64_text))const bytes = Uint8Array.from(atob(b64Text), (c) => c.charCodeAt(0));
const url = URL.createObjectURL(new Blob([bytes], { type: "application/pdf" }));atob does not accept URL-safe characters or a data URI prefix, so clean those first. If the string opens here but not in your code, compare the first bytes: a real PDF starts with %PDF-.
When Not to Use This Tool
This tool decodes one PDF and shows it. It does not edit, merge, compress or read scanned pages, and a password-protected PDF still asks for its password in the viewer. For Base64 that holds ordinary text, Base64 Decode is the better fit.
Limits and Safety
- The decoded file can be up to 10 MB, which is up to 15 million characters of Base64. Long text is decoded in a background worker, so the page stays usable.
- The page count is approximate. It is read from the PDF structure, and some compressed PDFs do not show it.
- The preview uses your browser's built-in PDF viewer, the same one that opens PDF files you download. A PDF can contain JavaScript. When the tool can see JavaScript in the file, it warns you and waits for you to press Show preview. Scripts inside compressed parts of a PDF cannot be seen by this check.
Your Data Stays in Your Browser
Decoding runs in your browser tab. The Base64 text and the PDF are not sent to a server and are not stored. See the Privacy Policy for details. To encode other files, see Base64 Encode and Image to Base64.