Base64 to PDF Converter

Paste Base64, a data URI or a whole JSON response and see the PDF. Pages, version, title and a cut-off file are checked. PDF to Base64 too.

Loading tool…

How it works

Paste

Raw or URL-safe Base64, a data URI, text with line breaks, or JSON such as Page.printToPDF's result. Missing = padding is fine.

Check

Preview the PDF and see its pages, version, title and producer. A cut-off file, an encrypted one, an image or Base64 encoded twice is named.

Save

Download the PDF under its own name or title. To go the other way, choose PDF to Base64 and drop a file.

Which Base64 does it read?

The standard alphabet (+ and /) and the URL-safe one (- and _), with or without = padding, and with line breaks such as MIME's 76-character lines. Any other character is an error with its line and column.

Source: RFC 4648 §4 Base64 · §5 URL-safe · RFC 2045 §6.8 line length

How do I view a Page.printToPDF result?

Chrome DevTools Protocol's Page.printToPDF returns {"data": "..."} in Base64: paste the whole response. With transferMode ReturnAsStream, data is empty and the PDF is read with IO.read. Puppeteer's and Playwright's page.pdf() return bytes: paste Buffer.from(pdf).toString("base64").

Source: CDP Page.printToPDF · CDP IO.read · Puppeteer page.pdf · Playwright page.pdf

How does it know the bytes are a PDF?

A PDF starts with %PDF- and its version, such as %PDF-1.7, and ends with %%EOF. The bytes are checked, not the data URI's label. Adobe's PDF Reference 1.7 says Acrobat accepts the header anywhere in the first 1,024 bytes, so a few bytes in front are flagged, not refused.

Source: ISO 32000-1 §7.5.2 header, §7.5.5 trailer · PDF Reference 1.7, Appendix H note 13

Why is my PDF cut off, or saved several times?

Every save ends in %%EOF. No %%EOF at the end usually means the file was cut short. An edited PDF can append its changes after the first %%EOF, so each incremental update adds one more. A Fast Web View file's extra %%EOF after its first page is not counted.

Source: ISO 32000-1 §7.5.5 and §7.5.6 · PDF Reference 1.7, Appendix F

Printing pages to PDF in code?

Run your Playwright or Puppeteer scripts on Browser Use cloud browsers.