Paste a Base64 string, a data URL, or a whole API response. The converter finds the PDF inside, repairs common copy-paste damage, checks the bytes, and gives you a file to preview or save. Nothing leaves your browser.
Drop a .txt, .b64, or .json file on the box to load its text. The page takes up to 50 MB of text, about a 37 MB PDF.
Paste Base64 on the left, or press Load sample. Each check fills in here.
Rendered by your browser's built-in PDF viewer. Phones often leave this frame blank, while Download still works.
Nobody types a Base64 PDF by hand. The string comes out of an API, a log line, or a script, and each source wraps the bytes its own way. Knowing the source tells you what cleanup to expect.
Load sample fills the box with the kind of payload a shipping webhook sends: a JSON object with the delivery note for order TX-77310 under document.content and the file name one level up. The converter pulls out both, so the download keeps the original name.
dataUses the URL-safe alphabet, with - and _ in place of + and /. Python's default b64decode quietly drops those two characters and returns a broken file. The converter swaps them back.contentBytesStandard Base64 with no prefix and no line breaks. Paste the value as is.encodedLabelThe label comes back in whatever image type the request named. Ask for PDF, or the bytes arrive as PNG or ZPL and the converter tells you which.dataPlain Base64 inside the JSON result. Puppeteer and Playwright decode this for you, so the raw string only shows up when you talk to the protocol directly.whole stringA data URL with an extra parameter: data:application/pdf;filename=generated.pdf;base64,... Code matching the exact prefix data:application/pdf;base64, misses this one. The converter reads the name and keeps the name for the download.bodyThe PDF sits in the body field next to "isBase64Encoded": true. Paste the whole response and the body gets picked out.any stringPHP escapes every / as \/ unless the code passes JSON_UNESCAPED_SLASHES. Copy a value out of the raw response and the backslashes come along. The converter strips them.Most failed decodes trace back to damage picked up between the source and your clipboard. The converter runs these repairs in order and lists each one under What changed, so you see how the decoded string differs from your paste.
filename or name supplies the download name.application/pdf gets flagged, but the bytes decide the verdict.\/ becomes /, and literal \n or \r sequences copied out of logs disappear.- becomes + and _ becomes /. A string holding both alphabets is rejected, since that points to two strings glued together.= signs are added back. A string one character away from any valid length is rejected, because a lost character has no safe repair.JVBERi0, the PDF went through Base64 twice, so the converter decodes once more.A long What changed list says more about the sender than about the PDF. If your own backend ships a data URL prefix and line breaks to an API expecting raw Base64, fix the sender. The service on the other end won't run these repairs for you.
Every file format opens with a fixed byte signature, and Base64 turns each signature into a fixed run of characters. Read the start of the string and you know what you have before decoding anything.
| Starts with | Decodes to | Next stop |
|---|---|---|
| JVBERi0 | %PDF-, a PDF | This page. |
| SlZCRVJp | JVBERi, a PDF encoded twice | This page. The second layer gets decoded for you. |
| iVBORw0KGgo | A PNG image | Base64 to Image |
| /9j/ | A JPEG image | Base64 to Image |
| R0lGOD | A GIF image | Base64 to Image |
| UEsDB | A ZIP container: DOCX, XLSX, PPTX, EPUB, or a plain ZIP | Base64 to File |
| 0M8R4KGx | A pre-2007 Office file: .doc, .xls, .ppt | Base64 to File |
| JSFQU | %!PS, a PostScript file | Convert with Ghostscript first. Readers won't open PostScript as a PDF. |
| PD94bWwg | <?xml, XML text | Base64 to Text |
| eyJ | {", JSON text | Base64 to Text. Often a JWT segment or an API error message. |
The converter runs the same check on the decoded bytes. Paste a PNG by mistake and the result panel names the format and links to the right tool, instead of handing you a .pdf file no reader will open.
The same string decodes in one language and fails in another. When your code rejects a string this page accepted, or worse, writes a file without complaint and the file won't open, check the row for your runtime.
| Decoder | Line breaks | - and _ | Missing = | data: prefix |
|---|---|---|---|---|
atob() in browsers | Ignored | InvalidCharacterError | Accepted | InvalidCharacterError |
Node.js Buffer.from(s, 'base64') | Ignored | Accepted | Accepted | Garbage bytes, no error |
Python base64.b64decode(s) | Ignored | Dropped, broken output | Incorrect padding | Garbage bytes, no error |
PHP base64_decode($s) | Ignored | Dropped, broken output | Accepted | Garbage bytes, no error |
Java Base64.getDecoder() | IllegalArgumentException | IllegalArgumentException | Accepted | IllegalArgumentException |
.NET Convert.FromBase64String() | Ignored | FormatException | FormatException | FormatException |
The amber cells are the dangerous ones. An exception tells you something broke. Silent garbage gets written to disk as invoice.pdf and fails three systems later. Before saving decoded bytes in any language, check the first five bytes read %PDF-. In Python, pass validate=True or use base64.urlsafe_b64decode for Gmail-style strings. In PHP, pass true as the second argument. In Java, getMimeDecoder() accepts wrapped lines and getUrlDecoder() reads the URL-safe alphabet.
The textarea slows to a crawl long before the browser runs out of memory. Decode big files from a terminal. Pick the line for your system:
base64 -d report.b64 > report.pdf (Linux)base64 -D -i report.b64 -o report.pdf (macOS)certutil -decode report.b64 report.pdf (Windows)The Ending row flags a missing %%EOF marker, the usual sign of a truncated string, but the lost bytes are gone for good. Excel is a frequent culprit: one cell holds 32,767 characters, so a string pasted through a spreadsheet loses everything past that point, about 24 KB of PDF. Log viewers and chat apps clip long lines too.
An encrypted PDF decodes fine and still asks for its password when opened. The Password row tells you in advance. This page does not remove or guess passwords.
Desktop Chrome, Edge, Firefox, and Safari render the preview frame. Mobile browsers often show a blank box or only the first page. Download and Open in new tab work on both.
The page decodes one string at a time. For a folder of .b64 files, a shell loop finishes in seconds:
for f in *.b64; do base64 -d "$f" > "${f%.b64}.pdf"; doneBlank tabs, damaged files, padding, and privacy.
Chrome, Edge, and Firefox block pages from sending the top window to a data: URL, a rule added in 2017 and 2018 to stop phishing pages posing as PDFs. Open in new tab on this page uses a Blob URL built from the decoded bytes, which browsers allow. In your own code, wrap the bytes in a Blob and pass URL.createObjectURL(blob) to window.open.
No. Decoding runs in JavaScript on this page, and the bytes live in a Blob in your browser memory. Toolexe never receives the string or the file. Closing the tab discards both.
Look at the Ending row. If the %%EOF marker is present, the string arrived whole and the PDF was already broken before encoding, so ask the source for a fresh copy. If the row says the end is missing, the string lost its tail during copying.
A Base64 PDF starts with JVBERi0, the encoded form of %PDF-. A string starting with SlZCRVJp is a PDF encoded twice. Anything else is a different format, and the prefix table on this page tells you which.
Standard Base64 length is a multiple of four, filled out with = signs at the end. URL-safe encoders often drop them. Adding them back changes no bytes in the PDF, and strict decoders such as .NET and Python refuse the string without them.
Some PDF writers and transfer steps put stray bytes before %PDF-. Adobe Reader tolerates up to 1,024 of them, and this page uses the same window. Strict libraries reject the file, so strip the leading bytes if another system refuses the file.