DevToys Pro

free web developer tools

Blog
Rate us:
Try browser extension:
← Back to Blog

AVIF and HEIF: Next-Generation Image Formats Explained

16 min read

Your website images are too large, slowing down page loads. You've heard about AVIF and HEIF as modern image formats with better compression than JPEG, but you're not sure which to use or how browser support works. This guide explains AVIF and HEIF image formats, comparing compression efficiency, browser compatibility, and practical conversion workflows for web development.

What Are AVIF and HEIF?

AVIF (AV1 Image File Format)

AVIF is an image format based on the AV1 video codec, standardized in 2019. It offers significant compression improvements over JPEG and PNG while maintaining high image quality.

Key features:

  • Superior compression: 30-50% smaller file sizes than JPEG at equivalent quality
  • Wide color gamut: HDR support, 10-bit and 12-bit color depth
  • Transparency: Alpha channel support like PNG
  • Animation: Can replace GIFs with better compression
  • Open standard: Royalty-free, developed by Alliance for Open Media

HEIF (High Efficiency Image Format)

HEIF (also called HEIC when using HEVC codec) is an image format based on the HEVC/H.265 video codec, standardized in 2015. Apple adopted HEIF as the default photo format for iOS 11+ and macOS High Sierra+.

Key features:

  • Efficient compression: 40-50% smaller than JPEG at similar quality
  • Multiple images: Store multiple images in one file (burst photos, Live Photos)
  • Metadata-rich: Depth maps, HDR, editing metadata
  • Native Apple support: Built into iOS and macOS
  • Patent concerns: HEVC codec has licensing requirements

Compression Comparison: AVIF vs HEIF vs WebP vs JPEG

Understanding relative file sizes at equivalent quality helps you choose the right format:

FormatFile Size (relative)QualityUse Case
JPEG100% (baseline)GoodUniversal compatibility
WebP70-80%Good-ExcellentWide browser support
HEIF50-60%ExcellentApple ecosystem
AVIF40-50%ExcellentModern web

Real-World Example: Photo Comparison

A high-resolution photograph (4000×3000px, detailed content):

  • JPEG (quality 85): 2.4 MB
  • WebP (quality 85): 1.7 MB (29% smaller)
  • HEIF (quality 85): 1.2 MB (50% smaller)
  • AVIF (quality 85): 1.0 MB (58% smaller)

For a typical website with 10 photos, switching from JPEG to AVIF saves ~14 MB of bandwidth per page load.

Browser Support and Compatibility

AVIF Browser Support (2026)

  • Chrome: ✅ Supported (v85+, August 2020)
  • Firefox: ✅ Supported (v93+, October 2021)
  • Edge: ✅ Supported (v121+, January 2024)
  • Safari: ✅ Supported (v16.1+, October 2022)
  • Opera: ✅ Supported (v71+)
  • Mobile browsers: ✅ Chrome Android, Safari iOS 16+

Global support: ~90% of users (as of 2026) can view AVIF images. Use fallback images for older browsers.

HEIF Browser Support (2026)

  • Safari: ✅ Native support (macOS/iOS)
  • Chrome/Firefox/Edge: ❌ No native support (requires conversion or polyfills)
  • Mobile browsers: ✅ Safari iOS, ❌ Chrome Android

Global support: ~20% of users (primarily Apple device users). HEIF is best for Apple ecosystem apps, not web delivery.

Fallback Strategy for Web

Use HTML <picture> element to serve AVIF with fallbacks:

<picture>
  <!-- Modern browsers get AVIF -->
  <source srcset="image.avif" type="image/avif">
  
  <!-- Fallback to WebP for better compression than JPEG -->
  <source srcset="image.webp" type="image/webp">
  
  <!-- Fallback to JPEG for oldest browsers -->
  <img src="image.jpg" alt="Description" loading="lazy">
</picture>

Browsers automatically select the first supported format, ensuring optimal file size with universal compatibility.

When to Use Each Format

Use AVIF When:

  • Web delivery: Serving images on websites with modern browser support
  • Maximum compression: Need the smallest possible file sizes
  • High quality: Maintaining visual quality with aggressive compression
  • Transparency needed: Replacing PNG with better compression
  • Animation: Replacing GIF with significantly smaller files
  • HDR content: Wide color gamut and 10/12-bit depth support

Use HEIF When:

  • Apple ecosystem: iOS/macOS apps with native support
  • Camera photos: iPhone/iPad default format (automatic)
  • Multi-image files: Burst photos, depth maps, editing data
  • Not for web: Requires conversion to AVIF/WebP/JPEG for browsers

Use WebP When:

  • Broader compatibility: Supporting older browsers (Chrome 23+, Firefox 65+)
  • Good enough compression: 25-35% smaller than JPEG is acceptable
  • Faster encoding: WebP encodes faster than AVIF

Use JPEG When:

  • Universal compatibility: Must support all browsers and devices
  • Email attachments: Not all email clients support modern formats
  • Legacy systems: Integrations that only accept JPEG

Conversion Workflows

Converting Existing Images to AVIF

When migrating websites from JPEG/PNG to AVIF:

  1. Convert to AVIF with quality 80-85 for photographs, 90+ for graphics
  2. Keep originals as JPEG/PNG fallbacks
  3. Test visual quality by comparing side-by-side
  4. Measure file sizes to verify compression gains
  5. Update HTML to use <picture> with fallbacks

Use Image Converter for client-side conversion of smaller images. For bulk processing or large files, use Server Image Processor for high-performance conversion.

Converting HEIF Photos to Web Formats

When users upload iPhone photos (HEIF/HEIC files):

  1. Detect HEIF format (file extension .heic or MIME type image/heic)
  2. Convert to AVIF for modern browsers
  3. Generate WebP as secondary fallback
  4. Generate JPEG for universal compatibility
  5. Serve using <picture> element

Quality Settings Guide

Content TypeAVIF QualityHEIF QualityNotes
Photographs75-8580-90Natural compression artifacts
Graphics/Logos90-10095-100Sharp edges need higher quality
Screenshots85-9590-100Text must remain readable
Thumbnails60-7570-80Small size allows more compression
Hero Images85-9590-100High visibility needs quality

Server-Side vs Client-Side Processing

Client-Side Processing

Advantages:

  • No server uploads (privacy-friendly)
  • Instant feedback for single images
  • No server costs

Limitations:

  • Slow for large images (10+ MB)
  • Browser memory limits (~100-200 MB)
  • Can't process batches efficiently
  • Limited codec options

Use Image Converter or Image Compressor for interactive single-image processing.

Server-Side Processing

Advantages:

  • High-performance encoding: Native codecs optimized for speed
  • Bulk processing: Convert hundreds of images in parallel
  • Advanced settings: Fine-tune compression levels, chroma subsampling, speed vs quality
  • Large files: Handle 50+ MB RAW photos, multi-megapixel images
  • Format support: AVIF, HEIF, WebP, JPEG, PNG, TIFF, BMP

Use cases:

  • Content migration: Converting entire image libraries
  • Build pipelines: Automated image optimization during deployment
  • User uploads: Processing photos uploaded by users
  • CDN preparation: Pre-generating multiple formats and sizes

Use Server Image Processor for enterprise-grade AVIF and HEIF conversion with native performance.

Image Format Decision Tree

Start: Need to optimize images?

  ├─ Targeting web browsers?

   ├─ Yes Must support all browsers?

   ├─ Yes Use JPEG + WebP + AVIF with <picture> fallback

   └─ No (modern only) → Use AVIF primary, WebP fallback

   └─ No Apple ecosystem app?

       ├─ Yes Use HEIF (native support)

       └─ No Use format matching your target platform

  ├─ Need transparency?

   └─ Yes AVIF > WebP > PNG (in order of compression)

  ├─ Need animation?

   └─ Yes AVIF > WebP > GIF (AVIF smallest)

  └─ Maximum compatibility required?

      └─ Yes JPEG (universal, but largest files)

Performance Impact: Real-World Metrics

Page Load Time Improvement

Case study: E-commerce product page with 12 product images

FormatTotal SizeLoad Time (3G)Load Time (4G)
JPEG (original)8.4 MB14.2s4.8s
WebP6.1 MB10.3s3.5s
AVIF3.8 MB6.4s2.2s

Result: Switching to AVIF saves 55% bandwidth and reduces load time by 54% on 3G, directly improving user experience and SEO rankings.

CDN and Bandwidth Costs

For a site serving 1 million page views/month with 12 images per page:

  • JPEG: 8.4 MB × 1M = 8.4 TB/month
  • AVIF: 3.8 MB × 1M = 3.8 TB/month
  • Savings: 4.6 TB/month (~55% reduction)

At typical CDN rates ($0.08-0.12/GB), AVIF saves $370-550/month in bandwidth costs.

Encoding Performance Comparison

Time to encode a 4000×3000px photo on modern hardware:

FormatEncode TimeFile SizeSpeed/Quality Ratio
JPEG (libjpeg-turbo)0.2s2.4 MBFast
WebP (libwebp)0.8s1.7 MBMedium
HEIF (libheif)2.5s1.2 MBSlow
AVIF (libavif, speed 6)3.5s1.0 MBSlow
AVIF (libavif, speed 9)0.9s1.1 MBMedium-Fast

Tip: For real-time user uploads, use faster AVIF encoding (speed 8-10). For build-time optimization, use slower encoding (speed 4-6) for maximum compression.

Common Pitfalls and Solutions

Pitfall 1: Over-Compression

Problem: Setting AVIF quality too low (below 70) produces visible artifacts even though file size is small.

Solution: Use quality 75-85 for photos, 90+ for graphics. Always visually compare before deploying.

Pitfall 2: No Fallback Images

Problem: Serving only AVIF breaks images for ~10% of users on older browsers.

Solution: Always provide WebP and JPEG fallbacks using <picture> element.

Pitfall 3: Ignoring Encoding Speed

Problem: Using slowest AVIF encoding (speed 0-3) takes minutes per image, blocking user uploads.

Solution: Use faster encoding (speed 8-10) for user uploads, slower encoding for build-time optimization.

Pitfall 4: Converting HEIF Directly to JPEG

Problem: Converting HEIF → JPEG wastes HEIF's compression advantage and produces larger files.

Solution: Convert HEIF → AVIF for modern browsers, with WebP/JPEG fallbacks.

Pitfall 5: Not Testing on Real Devices

Problem: Image looks perfect on desktop but has artifacts on mobile or different color profiles.

Solution: Test on actual devices (iPhone, Android, older browsers) before deploying.

Progressive Enhancement Strategy

Implement modern image formats gradually:

Phase 1: Add AVIF for New Content

  • Generate AVIF for new uploads alongside JPEG
  • Use <picture> with AVIF + JPEG fallback
  • Monitor browser analytics to verify support

Phase 2: Convert High-Traffic Pages

  • Identify top 20% of pages by traffic
  • Convert existing images to AVIF + WebP + JPEG
  • Measure load time and bandwidth improvements

Phase 3: Bulk Migration

  • Use server-side processing for entire image library
  • Automate format generation in build pipelines
  • Update CMS/templates to serve modern formats

Phase 4: Optimize and Monitor

  • A/B test different quality settings
  • Monitor Core Web Vitals (LCP improvements)
  • Track bandwidth cost savings

Format Support Matrix

FeatureJPEGPNGWebPHEIFAVIF
Lossy compression
Lossless compression
Transparency
Animation
HDR support
Browser support100%100%95%~20%~90%
Compression efficiencyBaselinePoorGoodExcellentBest
Encoding speedFastFastMediumSlowSlow

Summary

AVIF offers the best compression efficiency for web delivery with 90% browser support, making it ideal for modern websites. HEIF provides excellent compression for the Apple ecosystem but has limited browser support. Use a progressive enhancement strategy with <picture> fallbacks to serve AVIF to modern browsers while maintaining compatibility.

For interactive image conversion and optimization, use Image Converter and Image Compressor. For bulk processing, large files, and enterprise workflows, use Server Image Processor for high-performance AVIF and HEIF conversion with native codecs.