Convert Base64 to a file and a file to Base64: detects the type from the bytes, previews PDF, image, audio and video, accepts data URIs, base64url and JSON, and points to the invalid character.
The type comes from the bytes, not from the extension or what the API says.
Base64 represents every 3 bytes with 4 characters from an alphabet of 64 letters, digits, + and /, so the text is about 33% larger than the file (4 x ceil(n/3) characters for n bytes). The tool decodes that input and identifies the file from its first bytes, the magic signatures: %PDF- for PDF (in Base64 it starts with JVBERi), 89 50 4E 47 0D 0A 1A 0A for PNG (iVBORw0KGgo), FF D8 FF for JPEG (/9j/), GIF89a for GIF (R0lGOD), 50 4B 03 04 for ZIP (UEsDB), which is also the base of DOCX, XLSX and PPTX, told apart by the contents of the central directory. It accepts standard Base64 and base64url (RFC 4648, with - and _ instead of + and /), data URIs (RFC 2397, data:type;base64,), a JSON string or field, PEM blocks (64 columns, RFC 7468) and MIME text (76 columns, RFC 2045), with line breaks, spaces, missing padding and even URL-encoded text (%2B, %3D) or JSON escapes (\n, \u002B). When something is wrong it shows the exact position of the invalid character, with line, column and the surrounding text, and offers to decode ignoring the problem. The preview follows the detected type: PDF in the browser viewer, images, audio and video in players, text as text. HTML and SVG are never executed. In the other direction it encodes any file in chunks, without freezing, as plain Base64, data URI or base64url, with 64 or 76 column lines, and shows how much the size grew. Everything happens in the browser.
How to use
Paste the Base64 or pick the file.
In Base64 to file, paste the text, open a .txt or .json file, or use a sample. The type, size, SHA-256 and preview show up right away.
Check the suggested name, with the right extension, and download. If the input is a JSON with several fields, pick which one to decode. If there is an error, see the position and decide whether to ignore the character.
In File to Base64, drop the file, choose plain Base64, data URI or base64url and the line wrapping, then copy or download the result. Ready-made snippets for Bash, Node, Python, C# and PHP are included.
Embed
Use this tool on your site
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
<iframesrc="https://jkit.tools/embed/en-US/base64-to-file"width="100%"height="600"style="border:0"loading="lazy"referrerpolicy="no-referrer-when-downgrade"title="Base64 to File Decoder (PDF, Image, ZIP)"></iframe><p style="font-size:12px;margin:6px 0 0">Tool by <a href="https://jkit.tools/en/tools/base64-to-file">J-Kit</a></p>
Cite
Cite or link to this tool
Using it in a paper, class or post? Copy the link or a ready-made reference. The access date is today's.
<a href="https://jkit.tools/en/tools/base64-to-file">Base64 to File Decoder (PDF, Image, ZIP)</a>
References
Sources and references for this tool
These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
Paste the Base64 (with or without the data:application/pdf;base64, prefix) and check that the detected type is PDF. A PDF in Base64 starts with JVBERi, which is %PDF- encoded. The tool shows the PDF in the preview and downloads it with a .pdf extension. If the API response is JSON, paste the whole JSON: it finds the longest field that looks like Base64 and lets you switch fields.