Universal File to Base64 & Data URI Converter
Encode any document, binary file, font, or archive into Base64 strings and HTML Data URIs, or decode raw Base64 payloads back to downloadable files.
Click, drag & drop, or paste (Ctrl+V) any arbitrary file here
Supports PDFs, ZIP archives, images (PNG, JPG, WebP), audio (MP3, WAV), executables, and raw binaries. 100% computed inside your browser RAM.
Base64 File Converter & Data URI Generator — Reference Guide
Convert binary files, documents, PDF, audio, and images to RFC 4648 Base64 strings or decode Base64 data back to downloadable files securely in your browser.
Web MIME Types & Base64 Data URI Headers Reference Table
Standard web file extensions, official IANA media MIME types, exact Base64 Data URI scheme header prefixes, and byte size growth overhead.
| File Format | Extension | Official MIME Type | Data URI Scheme Prefix | Base64 Size Growth |
|---|---|---|---|---|
| PNG Image | .png | image/png | data:image/png;base64, | +33.33% |
| JPEG Image | .jpg, .jpeg | image/jpeg | data:image/jpeg;base64, | +33.33% |
| SVG Vector | .svg | image/svg+xml | data:image/svg+xml;base64, | +33.33% |
| WebP Image | .webp | image/webp | data:image/webp;base64, | +33.33% |
| PDF Document | application/pdf | data:application/pdf;base64, | +33.33% | |
| JSON Data | .json | application/json | data:application/json;base64, | +33.33% |
| WOFF2 Web Font | .woff2 | font/woff2 | data:font/woff2;base64, | +33.33% |
Key Parameters & Controls
| Parameter | Type / Unit | Description | Default |
|---|---|---|---|
| filePayload | File / Blob | Local file object selected through drag-and-drop or file system picker. | — |
| dataUriPrefix | string | MIME type prefix prepended to create executable data URIs (e.g., data:image/png;base64,). | — |
| lineBreakMode | string | Formatting option to insert RFC-compliant 76-character CRLF line wraps for MIME email transmission. | — |
Pro Tips & Best Practices
Generate compact Data URIs for SVGs, fonts, and micro-icons to eliminate separate HTTP roundtrips in standalone single-page applications.
Ensure accurate MIME type prefixes (e.g. application/pdf, font/woff2) so consuming web applications decode the stream with correct content handlers.
Base64 expands binary size by approximately 33%. For files over 5MB, consider binary streaming or object storage URLs instead of inline encoding.
Common Gotchas & Troubleshooting
⚠️Decoded file appears corrupted or unreadable
Check if the Base64 string contains invalid whitespace, url-encoding (%2B instead of +), or is missing padding '=' characters.
⚠️Browser tab becomes sluggish with huge files
Encoding files over 100MB in memory requires significant heap allocation. Process large binaries in chunks or use specialized native CLI utilities.
Frequently Asked Questions
How does Base64 encoding work?▼
Base64 groups binary data into 24-bit blocks (3 bytes) and splits them into four 6-bit numbers, mapping each to a 64-character ASCII alphabet (A-Z, a-z, 0-9, +, /).
What is a Data URI?▼
A Data URI enables inclusion of inline data in web documents using the format: data:[<mediatype>][;base64],<data>.
Does encoding a file compromise its security?▼
Base64 is strictly an encoding scheme, not encryption. Encoded files are in plain text representation and can be decoded by anyone.
Are my uploaded files sent to your server?▼
Never. File conversion is handled entirely in memory using the browser's native FileReader and Blob APIs. Zero bytes are uploaded.
Related Tools & Utilities
All Tools →Convert PNG, JPG, SVG, WebP, GIF, and ICO images to Base64 Data URIs, HTML img tags, CSS backgrounds, and React JSX.
Convert binary to decimal with our binary to decimal converter and calculator. Supports signed two's complement, fractional bits, and step-by-step math.
Convert length, mass, temperature, data storage (bytes, MB, GB), speed, and area with ultra-high floating-point precision.
Convert data storage units accurately across SI Decimal (KB, MB, GB, TB: 1000^n) and IEC Binary (KiB, MiB, GiB, TiB: 1024^n) with disk drive capacity explanation. 100% private in-browser tech cockpit.
High-precision in-browser color space converter between HEX, RGB, HSL, HSV, and CMYK models with delta-E accuracy, perceptual shade generation, and one-click CSS variable export.
Professional dimensional weight and chargeable weight calculator for FedEx, UPS, DHL, USPS, and IATA air freight. Compare carrier DIM divisors, model box bulge, optimize carton dimensions to eliminate ghost weight, and consolidate multi-piece consignments.