Base64 File Encoder
Convert any file to Base64 or a data URL. URL-safe Base64, line-wrapped output (76 chars), batch encoding, MIME detection, size warnings, copy/download. 100% client-side.
About Base64 File Encoder
Convert any file to Base64 or a data URL. URL-safe Base64, line-wrapped output (76 chars), batch encoding, MIME detection, size warnings, copy/download. 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does file-to-Base64 encoding work?
Each byte of your file is read into an ArrayBuffer, then converted to a Base64 string using btoa (binary-to-ASCII). The result can be output as raw Base64, a data: URL (with MIME type prefix), URL-safe Base64 (with -_ replacing +/), or line-wrapped at 76 characters per line (RFC 2045).
What's a data URL?
A data URL embeds the entire file inline as `data:<mime>;base64,<base64>`. You can paste it directly into <img src>, <a href>, or CSS url() without a separate request. Useful for inline images, embedded fonts, and self-contained HTML.
What extra features does this tool have?
10 extras: (1) Drag-drop file. (2) Batch encode multiple files. (3) Size warning for files > 2MB. (4) URL-safe Base64 output (-_ instead of +/). (5) Line-wrapped output at 76 chars (RFC 2045). (6) Stats (input size, output size, overhead %). (7) Preview first 500 chars. (8) Copy as data URL. (9) Copy as raw Base64. (10) History (localStorage — last 10 encodings).
Is my file uploaded anywhere?
No. All encoding runs in your browser using FileReader / ArrayBuffer. Your file never leaves your device.
Why is the Base64 output ~33% larger than the original?
Base64 encodes every 3 bytes into 4 ASCII characters (6 bits each). This 4/3 ratio means a 3 KB file becomes 4 KB of Base64 text. The stats panel shows the exact overhead percentage so you can plan for it.
Related tools
7Z Extractor
Inspect and extract files from 7z archives. Detects the 7z signature (0x37 0x7A 0xBC 0xAF 0x27 0x1C), parses the SignatureHeader and StartHeader, lists files from the archive metadata, and extracts STORE-method files when possible. Honest about LZMA compression limitations. 100% client-side.
APK Extractor
Extract and inspect Android APK files in the browser — pure JavaScript APK (ZIP) parser. View AndroidManifest.xml (binary XML detection), list DEX files, resources, and assets, extract individual files, detect app info (package name, version) from manifest. 100% client-side.
ARJ Extractor
Inspect ARJ archives. Detects the ARJ magic (0x60 0xEA), parses header structures, lists file entries with sizes and CRCs, and extracts STORE-method files when possible. Honest about ARJ compression limitations. 100% client-side.