Base64 to File Converter
Decode a Base64 string and download it as a file. Supports all file types with automatic MIME type detection and custom filenames.
Last Updated: August 2026
100% Client-Side — Your data never leaves your device
Paste a Base64 string (with or without a data: prefix) and download it as a file. The MIME type is auto-detected from data URIs.
Base64 to File in Code
Decode Base64 strings and save them as files programmatically.
Python
import base64
# Decode Base64 string to file
def base64_to_file(b64: str, output_path: str):
# Strip data URI prefix if present
if "," in b64:
b64 = b64.split(",", 1)[1]
with open(output_path, "wb") as f:
f.write(base64.b64decode(b64))
# Usage
base64_to_file("iVBORw0KGgo...", "image.png")
# Decode with MIME type detection
def base64_to_file_safe(b64: str, output_path: str):
import re
# Extract MIME type from data URI
mime_match = re.match(r"data:([^;]+)", b64)
if mime_match:
mime = mime_match.group(1)
print(f"Detected MIME: {mime}")
if "," in b64:
b64 = b64.split(",", 1)[1]
with open(output_path, "wb") as f:
f.write(base64.b64decode(b64))Frequently Asked Questions
Search below or browse through our most commonly asked questions.
Paste your Base64 string into the input area. The tool will automatically detect the file type if it contains a data URI scheme. You can then download the decoded file directly.
Any valid Base64 string can be decoded into a file. This includes images, documents (PDF, DOCX), audio, video, and archives (ZIP, TAR).