AVIF to Base64 Converter
Convert AVIF images to Base64 encoded strings instantly in your browser. Drag & drop or upload AVIF files for real-time Base64 encoding with preview.
Drag & drop your AVIF file here
or click to browse · Max 50 MB
About
AVIF (AV1 Image File Format) uses the AV1 codec for aggressive lossy and lossless compression, often achieving 50% smaller file sizes than JPEG at equivalent SSIM scores. Embedding AVIF assets as Base64 data URIs eliminates an HTTP round-trip per image, which matters when latency budgets are tight - each request on a 3G connection adds roughly 200 - 400ms of overhead. The trade-off: Base64 inflates payload size by a factor of approximately 1.37× (43 of the original byte count), so inlining a 500KB hero image is a net loss. This tool targets icons, sprites, and UI elements under 20KB where the round-trip cost dominates.
All encoding runs locally via the browser's native FileReader.readAsDataURL method. No server upload occurs. The converter validates AVIF files by inspecting the ISO Base Media File Format ftyp box for the avif or mif1 brand in the first 12 bytes. Note: this tool approximates output size before full encoding completes. Actual Base64 length depends on padding bytes and whether you strip the data: prefix.
Formulas
Base64 encoding maps every 3 input bytes to 4 ASCII characters drawn from a 64-symbol alphabet (A - Z, a - z, 0 - 9, +, /). The encoded output length is calculated as:
Where Lin = original file size in bytes, and Lout = number of Base64 characters. The complete data URI prepends a MIME header:
The prefix string data:image/avif;base64, adds 24 characters of overhead. Total payload size including prefix:
Where Stotal = total data URI string length. For MIME-compliant line wrapping (RFC 2045), lines are broken at 76 characters with CRLF delimiters.
Reference Data
| Image Format | Typical Compression | Browser Support | Base64 Overhead | Best Use Case for Inlining |
|---|---|---|---|---|
| AVIF | 50% smaller than JPEG | Chrome 85+, Firefox 93+, Safari 16+ | ×1.37 | Small icons < 20KB |
| WebP | 30% smaller than JPEG | All modern browsers | ×1.37 | Thumbnails, sprites |
| JPEG | Baseline lossy | Universal | ×1.37 | Email HTML templates |
| PNG | Lossless, larger files | Universal | ×1.37 | Transparency-critical icons |
| SVG | Vector, text-based | Universal | ×1.37 (or inline raw) | Logos, geometric shapes |
| GIF | Limited palette (256 colors) | Universal | ×1.37 | Simple animated icons |
| BMP | Uncompressed | Universal | ×1.37 | Never inline (too large) |
| TIFF | Lossless, very large | Limited (Safari only) | ×1.37 | Not recommended for web |
| ICO | Multi-resolution container | All browsers (favicon) | ×1.37 | Favicon data URIs |
| HEIC | Similar to AVIF (HEVC) | Safari only | ×1.37 | Not viable for web inlining |
| Base64 overhead factor: 43 ≈ 1.3333, plus up to 2 padding bytes (=) | ||||