Base64 to File & PDF Downloader

Convert Base64 strings and Data URIs into downloadable PDF documents, ZIP archives, JSON, text, audio, and binary files with automatic magic-byte file signature detection.

File details and download action will appear here in real time...

How to Decode Base64 to a File Online

1

Paste Base64 String

Enter your Base64 encoded PDF, ZIP, image, audio, or binary string into the input textarea or click Sample.

2

Live Inspection & Auto-Detection

Our engine checks magic header bytes in real time to automatically identify the true file extension and MIME type.

3

Download File

Click Download to save the decoded binary file directly onto your computer disk with byte-exact fidelity.

Supported File Types

PDF & Office Documents

Decodes Adobe PDF files (%PDF), plain text, JSON payloads, and XML configurations back to files.

ZIP & Compressed Archives

Extracts binary ZIP archives (PK..), GZIP tarballs, and software packages without corrupted bytes.

Images, Audio & Video

Decodes PNG, JPEG, SVG, WebP, MP3 audio, and MP4 video containers with instant local saving.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the Base64 to File & PDF Downloader do?

The Base64 to File Downloader decodes raw Base64 strings, RFC 2397 Data URIs, and URL-safe Base64 payloads into downloadable binary files including PDF documents, ZIP archives, images (PNG, JPEG, SVG, WebP, GIF), audio files (MP3, WAV), and video media.

It inspects magic header signatures (e.g. %PDF for Adobe PDF, PK\x03\x04 for ZIP, \x89PNG for PNG) to automatically identify the true MIME format and file extension even if the payload lacks a Data URI header.

Core Concepts

  • Magic Byte Signature Inspection: Many Base64 payloads originate from APIs without MIME wrappers. The tool reads the initial 4 to 16 binary bytes of the decoded buffer to identify file formats accurately.
  • RFC 2397 Data URI Parsing: Automatically strips leading data:application/pdf;base64,... prefixes and respects declared MIME parameters.
  • URL-Safe Base64 Normalization: Automatically converts - and _ characters back to standard + and / characters and balances padding (=).

How to use the tool?

  1. Paste Base64 Payload: Enter your Base64 encoded PDF, ZIP, or binary string into the input editor or click Sample.
  2. Optional Overrides: Specify a custom filename or override the MIME type if necessary in the top master toolbar.
  3. Live Decode & Download: The tool detects file metadata and formats in real time. Click Download to save the reconstructed binary file to disk.

Related Developer Utilities

  • Image to Base64: Convert image and SVG files into Base64 strings and Data URIs.
  • Base64 to Image: Decode Base64 strings specifically into visual image canvas previews and multi-format exports.
  • Base64 Encoder: Encode plain text strings into standard or URL-safe Base64 format.
  • Base64 Decoder: Decode Base64 strings into UTF-8 text or formatted JSON.

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/base64/base64-to-file) for programmatic decoding in CI/CD pipelines, document microservices, and automated testing workflows.

API Request Parameters

Name Type Description Example
rawText String / Object Raw Base64 string or Data URI to decode (aliases: text, payload, data, input, value). "JVBERi0xLjQK..."
customFilename String Optional filename override for output (aliases: filename). "report.pdf"
customMime String Optional MIME type override (aliases: mimeType). "application/pdf"

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/base64/base64-to-file \
  -H "Content-Type: application/json" \
  -d '{ "rawText": "JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCnRyYWlsZXI8PC9TaXplIDIvUm9vdCAxIDAgUj4+CnN0YXJ0eHJlZgoxMDUKJUVPRg==" }'

Python

import requests

url = "https://blueutils.com/api/base64/base64-to-file"
payload = {
    "rawText": "JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCnRyYWlsZXI8PC9TaXplIDIvUm9vdCAxIDAgUj4+CnN0YXJ0eHJlZgoxMDUKJUVPRg==",
    "customFilename": "report.pdf"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = "{\"rawText\": \"JVBERi0xLjQK...\"}";
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/base64/base64-to-file"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether decoding succeeded. true
dataUri String Complete RFC 2397 Data URI. "data:application/pdf;base64,..."
filename String Suggested or overridden filename. "downloaded_file.pdf"
fileExtension String Detected or overridden file extension. "pdf"
mimeType String Detected or overridden MIME type. "application/pdf"
fileTypeLabel String Human-readable file type label. "PDF Document"
byteLength Number Decoded file size in bytes. 300
formattedSize String Human-readable byte size. "300 B"

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "dataUri": "data:application/pdf;base64,JVBERi0xLjQK...",
  "filename": "downloaded_file.pdf",
  "fileExtension": "pdf",
  "mimeType": "application/pdf",
  "fileTypeLabel": "PDF Document",
  "byteLength": 300,
  "formattedSize": "300 B",
  "isText": false,
  "textPreview": null
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid input: Base64 string or Data URI cannot be empty."
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Native Usage

Decode Base64 payloads into binary files locally on your machine using standard command line tools:

Windows (PowerShell)

# Decode Base64 string to file in PowerShell
$b64 = "JVBERi0xLjQK..."
$bytes = [System.Convert]::FromBase64String($b64)
[System.IO.File]::WriteAllBytes("output.pdf", $bytes)

Linux / Unix (Bash)

# Decode Base64 string to file in Bash
echo "JVBERi0xLjQK..." | base64 -d > output.pdf

Python

import base64

b64_string = "JVBERi0xLjQK..."
with open("output.pdf", "wb") as f:
    f.write(base64.b64decode(b64_string))

Java

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;

public class Base64ToFile {
    public static void main(String[] args) throws Exception {
        String b64 = "JVBERi0xLjQK...";
        byte[] bytes = Base64.getDecoder().decode(b64);
        Files.write(Path.of("output.pdf"), bytes);
    }
}

Frequently Asked Questions (FAQ)

How do I convert a Base64 string to a downloadable file?

Paste your Base64 encoded payload into the input editor and click Decode & Download File. The tool auto-detects the MIME format and downloads the file.

How does the tool detect the file type?

The engine inspects magic header byte signatures (e.g. %PDF for PDF, PK for ZIP, PNG for PNG) to determine the exact file format.

Are my decoded files uploaded to any servers?

No. All Base64 parsing, binary blob reconstruction, and file downloading run 100% locally in your web browser.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.