Base64 Encoder & Asset Optimizer
Professional-grade Base64 converter. Features smart drag-and-drop, image compression, EXIF stripping, multi-language snippets (CSS/JSX/JSON), and magic-byte detection.
Drag & Drop file here
or Browse / Paste Text
Supports PNG, JPG, WEBP, PDF, FONTS, SVG, and more
About
This is not just a converter; it is a client-side asset pipeline designed to solve the specific friction points of modern frontend development. While standard tools simply translate binary to text, this engine addresses the performance penalty inherent in Data URIs. By increasing file size by 33%, Base64 encoding can bloat your critical rendering path if not managed correctly. This tool provides granular control over image quality and dimensions before encoding, effectively neutralizing the size overhead.
We prioritize Workflow Velocity and Data Integrity. The system utilizes Magic Byte analysis (checking the first few bytes of a file's hexadecimal signature) to detect MIME types accurately, even if file extensions are missing or incorrect. This ensures that the generated Data URI functions correctly across all browsers. Furthermore, the application processes everything locally within your browser's sandboxed environment, ensuring that sensitive assets - such as proprietary fonts, signed documents, or private keys - never touch a remote server.
Formulas
Base64 encoding works by mapping 3 bytes of binary data (8 bits each, 24 bits total) into 4 ASCII characters (6 bits each). The theoretical size increase is calculated as:
However, the actual Data URI includes a metadata header which adds a fixed overhead. The total character count C is:
Where n is the input file size in bytes. The header format is data:[mime];base64,. Optimization reduces n before this calculation occurs.
Reference Data
| Format / MIME | Magic Bytes (Hex Signature) | Compression Algorithm | Browser Support | Typical Header |
|---|---|---|---|---|
| PNG (image/png) | 89 50 4E 47 0D 0A 1A 0A | DEFLATE (Lossless) | All | data:image/png;base64, |
| JPEG (image/jpeg) | FF D8 FF E0 | DCT (Lossy) | All | data:image/jpeg;base64, |
| WebP (image/webp) | 52 49 46 46 ... 57 45 42 50 | VP8 (Lossy/Lossless) | Modern (97%+) | data:image/webp;base64, |
| GIF (image/gif) | 47 49 46 38 39 61 | LZW (Lossless) | All | data:image/gif;base64, |
| WOFF2 (font/woff2) | 77 4F 46 32 | Brotli | Modern | data:font/woff2;base64, |
| PDF (application/pdf) | 25 50 44 46 2D | Mixed | All (via viewer) | data:application/pdf;base64, |
| SVG (image/svg+xml) | <?xml or <svg | None (Text) | All | data:image/svg+xml;base64, |
| MP3 (audio/mpeg) | 49 44 33 | Perceptual coding | HTML5 Audio | data:audio/mpeg;base64, |
| GZIP (application/gzip) | 1F 8B | DEFLATE | N/A (Transfer) | data:application/gzip;base64, |
| ZIP (application/zip) | 50 4B 03 04 | DEFLATE | N/A (Download) | data:application/zip;base64, |