How AVIF Compression Works
A technical deep dive into the next-generation AVIF image format and its advanced compression technology.
By the CompressItAll team. Published 2025-11-23. Updated 2026-10-24.
AVIF compressor: compress AVIF images with our free tool
Quick Summary
- AVIF is based on the AV1 video codec, bringing video compression efficiency to still images
- Usually produces smaller files than JPEG and WebP at similar visual quality, with the saving depending on the image
- Supports HDR, wide color gamut, and 12-bit color depth
- Uses advanced techniques: inter/intra-frame prediction, transform coding, and modern entropy coding
AVIF Format Overview
AVIF (AV1 Image File Format) is a next-generation image format developed by the Alliance for Open Media. It leverages the sophisticated AV1 video codec to achieve unprecedented compression efficiency for still images. AVIF represents the most significant advancement in image compression in over a decade. See the AVIF specification (Alliance for Open Media).
The AV1 Codec Foundation
AVIF inherits its compression power from AV1, a royalty-free video codec designed to replace H.264 and VP9. Key innovations include:
- Block-Based Encoding: Variable block sizes from 4×4 to 128×128 pixels for adaptive compression
- Advanced Prediction: many intra-prediction modes, including 56 directional intra-prediction modes per the AV1 specification (Alliance for Open Media), for accurate spatial prediction
- Transform Coding: DCT, ADST, and identity transforms optimized for different content types
- Context-Adaptive Entropy Coding: Sophisticated probability modeling for efficient bit allocation
AVIF Compression Pipeline
1. Color Space Conversion
AVIF supports multiple color spaces including:
- sRGB: Standard color space for web
- Display P3: Wide color gamut for modern displays
- Rec. 2020: Ultra-wide gamut for HDR content
- BT.2100 PQ/HLG: HDR transfer functions
Images are typically converted to YUV color space (luma + chroma) for compression, following the AV1 specification. AVIF supports:
- 4:4:4: No chroma subsampling (highest quality)
- 4:2:2: Horizontal chroma subsampling
- 4:2:0: Horizontal and vertical subsampling (best compression)
- 4:0:0: Grayscale (no chroma)
2. Block Partitioning
The encoder divides the image into superblocks (64×64 or 128×128) and recursively partitions them using:
- PARTITION_NONE: No subdivision
- PARTITION_HORZ/VERT: Horizontal or vertical split
- PARTITION_SPLIT: Quad-tree split into 4 equal parts
- Complex partitions: T-shaped, H-shaped, and asymmetric splits
3. Intra-Prediction
For still images, AVIF uses only intra-frame prediction (predicting from already-encoded pixels). AV1 provides directional and non-directional prediction modes:
- DC Prediction: Average of neighboring pixels
- Smooth Prediction: Gradient-based extrapolation
- Directional Modes: 56 directions, built from 8 base angles with offsets in steps of 3°
- Paeth Prediction: Intelligent selection of left, top, or diagonal neighbor
- CFL (Chroma from Luma): Predicts chroma channels from luma, as specified in the AV1 specification (Alliance for Open Media)
4. Transform Coding
Residuals (difference between predicted and actual pixels) are transformed using:
- DCT (Discrete Cosine Transform): Standard for natural images
- ADST (Asymmetric Discrete Sine Transform): Better for edges
- Identity Transform: No transform (for very detailed areas)
- Hybrid Transforms: Different transforms for horizontal and vertical
Transform sizes range from 4×4 to 64×64, adaptively chosen per block.
5. Quantization
Transform coefficients are quantized to reduce precision and achieve compression. AVIF uses:
- Quantization Parameter (QP): Range 0-63, where lower = higher quality
- Adaptive Quantization: Different QP per block based on visual importance
- Quantization Matrices: Custom weighting for different frequencies
6. Entropy Coding
Quantized coefficients and prediction modes are entropy coded using:
- Context-Dependent Arithmetic Coding: Probability model adapts based on neighboring symbols
- Symbol Grouping: Efficient coding of coefficient magnitudes and signs
- Coefficient Ordering: Zig-zag scan optimized for zeros
AVIF vs Other Formats: Compression Comparison
| Feature | AVIF | WebP | JPEG | PNG |
|---|---|---|---|---|
| Compression Efficiency | Best of the common web formats | Very good | Good (baseline) | Poor for photos |
| Encoding Speed | Slow to encode, especially at the slowest settings | Medium | Fast (baseline) | Medium |
| Decoding Speed | Slower than JPEG | Medium (similar to JPEG) | Fast | Fast |
| HDR Support | ✓ Yes (10/12-bit) | ✗ No | ✗ No | Limited (16-bit) |
| Animation | ✓ Yes (efficient) | ✓ Yes | ✗ No | ✓ (APNG) |
| Browser Support | Current Chrome, Firefox, Safari 16.4+, Edge 121+ (caniuse) | All current major browsers (caniuse) | Universal (caniuse) | Universal (caniuse) |
AVIF Optimization Strategies
Quality Settings
Encoders such as libaom expose a quantizer scale from 0 to 63, where a lower number means higher quality and a larger file, and a higher number means lower quality and a smaller file. Exact numbers differ between encoders, so test on your own images. Rough starting points:
- Low values (about 0-15): very high quality, large files
- Mid-low values (about 16-23): high quality, a common starting range for photos
- Mid values (about 24-32): good quality, more aggressive compression
- High values (33 and above): visibly lower quality, smallest files
Value 63 is the lowest quality on this scale, not a lossless setting. Lossless AVIF is a separate encoder mode.
Speed vs Quality Tradeoff
AVIF encoders offer speed presets (0-10):
- Slow speeds (low numbers): slowest, with the best compression for a given quality
- Middle speeds: a balance of encoding time and compression
- Fast speeds (high numbers): quicker to encode, with somewhat lower compression for the same quality
- Fastest speeds: the quickest encodes and the weakest compression
Chroma Subsampling Choice
- 4:4:4: Use for graphics, logos, screenshots (no quality loss in chroma)
- 4:2:0: Use for photographs (human eye less sensitive to chroma detail)
Illustrative File Size Comparison
Illustrative example for a 4000×3000px photograph. These numbers are not from a controlled test:
- Original: 36 MB uncompressed
- PNG (optimized): 12 MB
- JPEG (quality 85): 1.8 MB
- WebP (quality 85): 1.2 MB
- AVIF (CRF 20): 0.8 MB ⭐
These figures are an illustration, not a measurement. Real savings depend on the image, the encoder and the quality setting.
When to Use AVIF
AVIF is ideal for:
- Modern web applications targeting current browsers
- Applications requiring the absolute smallest file sizes
- HDR and wide color gamut content
- High-resolution images (8K, 10K) where file size matters most
- Situations where encoding time is not critical (batch processing, CDN transcoding)
Browser Support & Fallbacks
AVIF Support:
- Chrome: Since version 85 (2020)
- Edge: Since version 121 (2024)
- Firefox: Since version 93 (2021)
- Safari: Since version 16 (2022)
- Opera: Since version 71 (2020)
- iOS Safari: Since iOS 16 (2022)
Always provide fallbacks using the <picture> element:
<picture>
<!-- AVIF for best compression -->
<source srcset="image.avif" type="image/avif">
<!-- WebP fallback -->
<source srcset="image.webp" type="image/webp">
<!-- JPEG fallback -->
<img src="image.jpg" alt="Description">
</picture>Ready to Compress AVIF?
Use the compress avif tool to reduce file sizes with the settings discussed above. Supports batch processing with no registration required.
Future of AVIF
AVIF continues to evolve with:
- Hardware Acceleration: Native decode support in modern GPUs and mobile processors
- Faster Encoders: Optimized implementations reducing encoding time by 10-50×
- Wider Adoption: CDNs and image optimization services adding AVIF support
- Enhanced Features: Film grain synthesis, depth maps, and advanced metadata
Ready to Compress AVIF Images?
Use our free online AVIF compressor to reduce file sizes while keeping the quality you choose. Supports batch processing with no registration required.
compress avif →