Konverter
Base64 File Converter
The Base64 File Converter encodes any local file into a Base64 string and can decode a Base64 string back into a downloadable file. All processing happens entirely in your browser – no file data ever leaves your device. It is especially useful for embedding images, fonts, or documents as data URIs in HTML and CSS, or for packing binary assets into JSON payloads and email attachments.
What is Base64 file encoding?
Base64 file encoding converts the raw bytes of any file into a sequence of printable ASCII characters using the Base64 alphabet. This makes it possible to embed binary content (such as images or PDFs) in text-based formats like HTML, CSS, JSON, or XML without corrupting the data. The resulting Base64 string is approximately 33% larger than the original file. A data URI combines the MIME type and Base64 payload into a single self-contained URL that browsers and many apps can render directly.
How does the tool work?
Drop a file onto the upload area or click to select one. The browser reads the file using the FileReader API and encodes its raw bytes to Base64 entirely in memory. The output is shown as a plain Base64 string and, if a recognized MIME type is detected, also formatted as a ready-to-use data URI (e.g. data:image/png;base64,...). To decode, paste a Base64 string or data URI; the tool strips the header if present, decodes the payload, and lets you download the reconstructed file. Nothing is sent to any server.
Typical Use Cases
- Inlining images or SVGs as data URIs in HTML or CSS to eliminate extra HTTP requests
- Packaging binary assets inside JSON API requests or responses
- Attaching small binary files to email bodies without a separate MIME attachment
- Quickly inspecting or reconstructing files stored as Base64 in databases or config files
Step-by-step Guide
- Step 1: Drag and drop a file onto the upload zone or click 'Select file' to choose one.
- Step 2: The tool encodes the file and displays the Base64 string and the data URI.
- Step 3: Copy the result or use the download button to save the encoded output.
- Step 4: To decode, switch to the decode tab, paste your Base64 string, and download the reconstructed file.
Example
Input
logo.png (binary image file)
Output
data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...
Tips & Notes
- Inlining very large files as data URIs can hurt page performance; keep Base64-embedded assets under ~10 KB for best results.
- Always include the correct MIME type in your data URI so browsers and consumers can interpret the file correctly.
- If you only need to encode plain text, use the Base64 Encoder (base64-encoder) instead for a simpler workflow.
Frequently Asked Questions
Is my file uploaded to a server?
No. The entire encoding and decoding process runs in your browser using the FileReader API. Your file never leaves your device.
What file types are supported?
Any file type is supported because the tool encodes raw bytes. Images, PDFs, fonts, archives, and executables all work. The MIME type is detected from the file extension for the data URI header.
Why does the Base64 output look much larger than the original file?
Base64 encodes every 3 bytes as 4 characters, adding about 33% to the data size. For a 100 KB image, expect roughly 133 KB of Base64 output.
Base64 File Converter
Convert strings, files, or images to their Base64 representation and decode Base64 back into files.
Open Tool