Base64 to PDF

Base64 to PDF decodes a Base64 PDF string or data:application/pdf;base64 URI into a file you can preview and download. Use it to convert Base64 to PDF or decode Base64 PDF content when an API or email returns a document as text, and check the Base64 PDF sample for the expected input. The bytes are decoded in your browser and verified before download.

Load Base64 from a text file

No file chosen

You can also drop a .txt or .b64 file anywhere in this tool.

Preview PDF · 630 B · 840 Base64 chars

Base64 to PDF turns a Base64 string or a data:application/pdf;base64,... URI back into the original document, previews it in the page and downloads it as document.pdf, with every step running in JavaScript inside your browser tab. The file never reaches a server.

It is the quickest way to open an invoice that a JSON API returns as text instead of a file, to recover a contract pasted into a support ticket as one long line of characters, or to pull an attachment out of a database export that stores documents in a Base64 column. You can also drop a .b64 file written by a script and get a readable PDF without opening a terminal. Because the work is local, the page still decodes after the first load, even offline.

How to use

  1. Paste or drop the payload. Paste the string into the input box, use Paste from clipboard, or drop a .txt, .b64 or .base64 file onto the panel. Text input is capped at 5 MB, which is roughly a 3.7 MB PDF after decoding.
  2. Let the signature check run. There are no options to set. Whitespace is ignored, a data: prefix is detected, and the first four bytes must read %PDF. The preview and the result line update after 150 ms.
  3. Download the result. Download PDF saves the base64 to pdf result as document.pdf, and Open in new tab opens the same blob. The result line reports the decoded size and the Base64 character count, so you can confirm the result before opening the document.

Format, checks and limits

Most failures on this page come from the wrapper around the payload or from its two ends, not from the middle. The notes below cover the prefix the decoder accepts, the bytes it looks for, and the size ceiling. A file can decode cleanly and still fail to open, so the result line reports the byte size before you download.

The data:application/pdf;base64 prefix

A data:application/pdf;base64, prefix declares the MIME type and marks everything after the comma as Base64. The decoder only recognizes that exact pattern: data:application/pdf,JVBERi0... without ;base64 is rejected with Input is not valid Base64., and a URL-safe value containing - or _ fails the same way. A bare string with no prefix is accepted, because the signature test already proves the payload is a PDF. The prefix is matched case-insensitively, so uppercase variants work, but the comma is mandatory. Keep the URI on one line and avoid extra commas inside the body.

How to decode base64 pdf without corrupting it

JVBERi0 is the Base64 form of %PDF-1, and a complete document ends with %%EOF, which encodes to JSVFT0Y=. After decoding, the tool tests four bytes, 25 50 44 46. A PNG payload starting iVBORw0KGgo stops with This file type is not supported. instead of being saved. Truncated strings often decode into a file that opens as blank pages, and a wrong number of = characters produces Base64 padding is invalid.

Convert base64 to pdf sizes and limits

Base64 adds a third: a 1 MB PDF becomes about 1,398,104 characters, and the 5 MB text cap corresponds to roughly 3.75 MB of document. Every download is named document.pdf, because the input carries no filename, so rename the file before filing it. For batches or larger files, decode in a terminal with base64 -d invoice.b64 > invoice.pdf (macOS uses base64 -D) and compare the byte size with the result line.

FAQ

How do I convert base64 to pdf?

Paste the string or the data URI into the input box, wait for the preview, then click Download PDF. The tool saves document.pdf without contacting a server, and it treats a bare string and a full data URI the same way. If the preview stays empty, the payload is not a PDF.

Is there a base64 pdf sample I can test with?

The four characters JVBERi0 are the Base64 form of %PDF-1, and a complete file also ends with JSVFT0Y=, the encoding of %%EOF. A sample missing either marker will fail the signature check or render as blank pages, so test with a real export rather than a truncated snippet.

Why does my file fail with “This file type is not supported.”?

The bytes decoded correctly but do not begin with %PDF. A common cause is pasting an image or ZIP payload, which starts iVBORw0KGgo or UEsDB. Re-export the document as a PDF and encode the new file, or use the decoder built for that format.

Is my PDF uploaded anywhere?

No. Decoding runs in JavaScript on your device, the bytes stay in browser memory, and the preview uses a local blob URL. Nothing is sent to a server, logged or kept after you close the tab, so a base64 to pdf check never exposes a contract, invoice or internal report.

What is the largest PDF I can decode?

The text box and the file picker both stop at 5 MB of Base64, which is about 3.75 MB of PDF. Larger files show “File is too large for browser-side processing.” and need a command-line decoder, because the payload is held in memory while the preview is built.

Base64 to PDF only rebuilds documents. If you need the opposite direction, PDF to Base64 encodes a file into a data URI you can embed in HTML or JSON. Base64 to Image decodes PNG and JPEG payloads with the same local preview before download, and Text to Base64 covers plain UTF-8 strings when the payload is not a file at all. All three pages accept paste and drop, and none of them uploads anything.