Skip to content
ToolPlankDEV
Encoders & Decoders
100% In-Browser Execution

Updated:

Base64 to PDF Converter

Paste a Base64 string or a data URI to convert base64 to pdf in your browser. The tool checks that the data really is a PDF, shows a preview with its size, version and approximate page count, and lets you download the file. Nothing is uploaded.

Processing in browser...

Loading the tool. It runs entirely in your browser, so your data is never uploaded.

More free tools you may need next.

Quick Guide

How to use Base64 to PDF

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste the Base64 text

    Paste the Base64 string into the left box, press Paste, or open a .txt or .json file that holds it. Bare Base64, a data:application/pdf;base64, URI, a quoted JSON value and a whole JSON response all work. Sample loads a small one-page PDF.

  2. 02

    Check the preview

    The PDF appears on the right in your browser's own PDF viewer. The footer shows the PDF version, the file size and an approximate page count. If the text is not a PDF, the tool says what it decodes to instead.

  3. 03

    Name and download the file

    Type a file name, then press Download .pdf. Open in new tab shows the PDF in a full browser tab. The swap button sends the PDF to the PDF to Base64 tool.

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:

Text
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 %%EOF end 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:

HTML
<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.

Python
import base64

with open("out.pdf", "wb") as f:
    f.write(base64.b64decode(b64_text))
JavaScript
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.

Frequently Asked Questions

Technical Q&A for Base64 to PDF

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the Base64 string into the tool. It decodes the text in your browser, checks that it is a PDF, shows a preview and lets you download the file with the name you choose.

Paste it here and the preview opens in your browser's PDF viewer. Press Open in new tab to see it full size. You can also put a data:application/pdf;base64, URI in an iframe, but some browsers block opening data URIs directly in the address bar.

The most common reasons are a cut-off string, extra characters such as quotes or a JSON key, a data URI prefix with a typo, or data that is not a PDF at all. A PDF in Base64 starts with JVBERi0. The tool removes prefixes and quotes and tells you what is wrong when it cannot decode the text.

It is a PDF file written as plain text. Every 3 bytes of the file become 4 letters, digits or symbols, so the file can travel inside JSON, XML, email or an HTML page. Decoding reverses it byte for byte.

Put a data URI in the src of an iframe or embed tag: data:application/pdf;base64, followed by the string. Large PDFs make the page heavy, and some mobile browsers will not show the PDF inline.

Paste the text here. If it is a PDF, you get a preview and a .pdf download. If it is another type, such as a PNG or a ZIP, the tool names the type and offers the matching extension.

Yes. It removes a data:application/pdf;base64, prefix, quotes and line breaks, and reads - and _ as well as + and /. Missing = padding is added, and the tool lists each fix it made.

The preview uses your browser's own PDF viewer. If the tool finds JavaScript it can see in the file, it warns you and waits until you press Show preview. Scripts hidden in compressed parts of a PDF cannot be seen by this check, so only open files you trust.

No. The decoding happens in your browser tab, and the text and the PDF are never sent to a server.

If the data is not a PDF, the tool tells you what it looks like, for example a PNG image, a ZIP file or plain text, and still lets you download it with the matching extension.