Base64 to PDF turns a Base64-encoded string back into a normal PDF file. Paste the string or upload a .txt file, review the first-page preview, then press Decode & Download PDF. The tool removes whitespace and quotes, strips data URL prefixes, and verifies the %PDF- signature before saving. Everything happens in your browser, so your data never leaves your device. The process is free, needs no signup, and works on phones, tablets and computers.
What is a Base64 to PDF converter?
A Base64 to PDF converter takes text that has been encoded with Base64 and turns it back into the original PDF file. Base64 is a way to store binary data as plain text, using only letters, digits and a few symbols. Developers use it because plain text can travel safely through systems that were not designed for binary files: JSON APIs, email bodies, HTML attributes, database columns and configuration files.
Most people search for “base64 to pdf” after they receive an encoded PDF from an API response, a support ticket, a database export or a webhook. The string looks like meaningless letters and digits, but it contains a full PDF inside. This tool decodes it back to bytes, checks the %PDF- header, and lets you save a real file.
Base64 is defined in RFC 4648, and the PDF format is defined in ISO 32000. You can read more about the PDF background in the Wikipedia article on PDF, and about the encoding in the Wikipedia article on Base64.
How to decode Base64 to PDF in 4 steps
The tool follows a simple path. You never need to install software or create an account. Follow these steps for a clean result on your first try.
- Paste or upload your Base64Paste the Base64 string into the input box, or drop a .txt or .b64 file that contains it. The tool cleans up line breaks, quotes and data URL prefixes automatically.
- Review the previewThe first PDF page appears in the preview panel within a second, so you can confirm the data is a real PDF before saving. Statistics show the character count and detected format.
- Click Decode & DownloadPress the convert button and the tool decodes the Base64 into bytes, verifies the PDF signature, reads the page count and prepares the file.
- Save or start againDownload the PDF with a single click, or press New to clear the input and decode another string. The whole process runs inside your browser.
Most strings decode in under a second. Large PDFs take a little longer because the browser has to render the first page for the preview. If you need to try a different string, press Clear and paste again — nothing is cached between attempts.
Everything the decoder can do
Beyond basic decoding, the tool handles the messy details that trip up most users. This table lists each capability and what it does.
| Feature | What it does |
|---|---|
| Data URL stripping | Accepts strings that start with data:application/pdf;base64, and generic data URLs. |
| Whitespace cleaning | Removes line breaks, spaces and tabs that break standard Base64 decoders. |
| Quote stripping | Drops the leading and trailing quotes that appear when a string is pasted from JSON. |
| Signature validation | Checks for the %PDF- header and stops the convert button when the data is not a real PDF. |
| Live preview | Renders the first page with pdf.js so you can confirm the file before saving. |
| Page count | Reads the page count with pdf.js and shows it in the result panel. |
| File size | Reports the decoded size in bytes, KB or MB. |
| Alt upload | Accepts .txt and .b64 files so you can drag a saved dump instead of pasting. |
| Sample loader | Loads a small valid PDF example so you can see the tool work before pasting anything. |
| Clipboard paste | Reads the clipboard with one click when the browser permits it. |
After downloading, you can edit the result in our PDF editor, add a signature with the sign PDF tool, or combine it with other files using merge PDFs.
Why decode Base64 to PDF?
Base64 shows up in dozens of developer workflows. These are the most common situations where turning it back into a real file saves time.
API responses
REST and GraphQL APIs often return PDFs as Base64 fields. Paste the string and get a file you can open, rather than saving JSON and decoding it by hand.
Email attachments
Raw MIME messages store attachments as Base64. Extract the string and convert it back to a PDF without opening a mail client.
Database exports
Columns of type BLOB are often dumped as Base64 text. Turn one row into a PDF to inspect it, without writing a decoder script.
Debugging webhooks
Payment, e-signature and invoice webhooks ship PDF payloads encoded. Verify the document content before wiring it into your pipeline.
Data URL sharing
A link may embed a PDF as data:application/pdf;base64,… Use the tool to strip the prefix and download a file that opens in any reader.
Backup extraction
Backups of document stores often serialize PDFs as Base64. Convert one entry to check integrity before restoring the whole archive.
Once you have the PDF, continue the workflow with compress PDF, protect PDF, or split PDF.
Your data stays private
Privacy matters because Base64 strings can contain contracts, invoices, IDs and medical records. This decoder runs entirely in your browser. JavaScript reads the string, cleans it, validates it and builds the PDF. Nothing is uploaded to any server, and the tool does not store the string between visits.
- No uploads. The Base64 string is processed entirely on your device.
- No tracking of contents. The page never sends the string to any endpoint — it never leaves your browser tab.
- No account needed. You can decode without logging in. Read our privacy policy for full details about the site.
Base64 format explained
Base64 encoding turns three bytes of binary data into four printable characters, which is why encoded output is about 33 percent larger than the original file. The alphabet uses A–Z, a–z, 0–9, plus (+) and slash (/), with equals (=) as padding. Because those last two characters have special meaning in URLs, Base64 URL-safe variants use - and _ instead. The decoder on this page accepts both alphabets.
| Format | Example prefix | Used in |
|---|---|---|
| Raw Base64 | JVBERi0xLjQK… | Database columns, API JSON fields |
| Data URL (PDF) | data:application/pdf;base64,… | HTML attributes, CSS, browser exports |
| Data URL (generic) | data:application/octet-stream;base64,… | Generic web exports, downloads |
| MIME attachment | Content-Transfer-Encoding: base64 | Email bodies |
| URL-safe Base64 | - and _ instead of + and / | JWTs, URL parameters, filenames |
Tip: if you copied the string from a URL, browser address bar or a JSON file, paste it exactly as-is. The tool strips data URL prefixes, quotes and whitespace for you, so no manual editing is needed.
Tips for reliable decoding
- Copy the full string. Truncated Base64 fails the %PDF- signature check and will show Not PDF.
- Do not retype manually. A single wrong character produces a corrupted file. Use copy and paste, or save the source to a .txt file.
- Watch the format badge. Raw Base64 and Data URL both decode; Not PDF means the string decodes but is not a PDF.
- Check the preview. If the first page looks right, the rest of the file almost certainly decodes correctly.
- Use a .b64 file when the string is huge. Browsers handle text areas up to tens of megabytes, but saving to a file and uploading is often smoother.
- Watch size limits. Base64 is 33 percent larger, so a 10 MB limit on the decoded file equals about 13 MB of input.
Common problems and quick fixes
Most decoding problems come from a handful of causes. Check this list before you start over, because each fix takes only a few seconds.
| Problem | Likely cause | Fix |
|---|---|---|
| Format badge says Not PDF | The string decodes but lacks the %PDF- header. | Confirm the original is a PDF. It may be an image or another document encoded as Base64. |
| Preview is blank | Rendering failed, or the string is truncated. | Paste the full string again. If it still fails, request the complete data from the source. |
| Decoded file is too big | Your plan limits the decoded size. | Ask the sender for a smaller copy, or use a PDF compressor after decoding. |
| Invalid character error | The string contains unrelated text, curly quotes or emoji. | Copy only the Base64 portion. The tool strips common extras, but unrelated text has to be removed manually. |
| Data URL prefix not stripped | The prefix used an unusual mime type. | Remove everything up to the first comma, then paste the remainder. |
| Paste button does nothing | Browser blocked clipboard access. | Paste manually with Ctrl+V (Cmd+V on Mac). |
If a string still fails to decode after these checks, open it in a text editor and confirm it ends with the two padding characters (==) and starts with the letters JVBER. Those two signals almost always mean the string is a valid PDF.
Online decoder versus other methods
You can also decode Base64 with the command line, a browser developer tool, or code you write yourself. Each method has trade-offs, and an online tool wins when you need speed, a preview and no setup.
| Method | Install needed | Preview | Signature check | Works on any device |
|---|---|---|---|---|
| This decoder | No | Yes | Yes | Yes |
| Command line (base64 -d) | Yes | No | No | Desktop only |
| Browser devtools | No | No | No | Desktop only |
| Custom script | Yes | No | Depends | Depends |
For one-off checks, the browser route removes friction. When you already have a decoding pipeline in code, use that instead and treat this page as a quick verification step.
Related PDF tools
A good document workflow often needs more than one step. These tools work well after Base64 to PDF, and all of them are free.
You can also read practical guides on our blog, or learn more about the team on the About page.
Frequently asked questions
What is a Base64 to PDF converter?
Is the Base64 to PDF converter free?
Does the tool upload my Base64 data to a server?
Can I paste a data URL instead of raw Base64?
Does the tool remove line breaks and spaces from the Base64 string?
How do I know the Base64 string is a valid PDF?
How big a Base64 string can I decode?
Can I decode Base64 from a .txt file?
Does it work on iPhone and Android?
Can I see a preview before downloading?
What if the Base64 string is truncated?
Can I convert a PDF to Base64 with this tool?
Ready to decode your Base64?
Paste the string, check the preview, and download the PDF in seconds. Free, private and built for every device.
Decode Base64 now