Format Guide 11 min read

HDR Images on the Web: Complete Implementation Guide

Learn how to serve HDR images on the web. Covers HDR formats, display detection, tone mapping, and practical implementation for modern browsers and devices.

By ImageGuide Team ยท Published January 19, 2026 ยท Updated January 19, 2026
HDRwide gamutDisplay P3image formatscolor management

HDR (High Dynamic Range) displays are now mainstream in phones, laptops, and monitors. This guide covers how to serve HDR images on the web, from format selection to display detection.

Understanding HDR on the Web

What Makes an Image HDR?

PropertySDRHDR
Dynamic range~6 stops10+ stops
Peak brightness100 nits400-1000+ nits
Color spacesRGBDisplay P3 / Rec. 2020
Bit depth8-bit10-bit or higher

HDR Display Adoption

Device CategoryHDR Support
iPhone (12+)HDR, Display P3
MacBook ProHDR, Display P3
iPad ProHDR, Display P3
High-end AndroidHDR10
Most laptopsSDR only

HDR Image Formats

FormatHDR SupportBrowser Support
AVIFExcellentChrome, Firefox, Safari
JPEG XLExcellentSafari only
WebPNoWide
JPEGNoUniversal

AVIF is currently the best choice for HDR on the web.

Detecting HDR Displays

CSS Media Queries

@media (dynamic-range: high) {
  .hero-image {
    background-image: url('hero-hdr.avif');
  }
}

@media (dynamic-range: standard) {
  .hero-image {
    background-image: url('hero-sdr.jpg');
  }
}

@media (color-gamut: p3) {
  .product-image {
    background-image: url('product-p3.avif');
  }
}

JavaScript Detection

function getDisplayCapabilities() {
  return {
    hdr: window.matchMedia('(dynamic-range: high)').matches,
    p3: window.matchMedia('(color-gamut: p3)').matches,
    rec2020: window.matchMedia('(color-gamut: rec2020)').matches
  };
}

const capabilities = getDisplayCapabilities();
if (capabilities.hdr && capabilities.p3) {
  loadHDRImages();
}

Serving HDR Images

Picture Element Approach

<picture>
  <source
    media="(dynamic-range: high)"
    srcset="sunset-hdr.avif"
    type="image/avif"
  >
  <source srcset="sunset-sdr.avif" type="image/avif">
  <source srcset="sunset.webp" type="image/webp">
  <img src="sunset.jpg" alt="Vibrant sunset over mountains">
</picture>

Using Image CDNs

Sirv can serve optimized images automatically:

<img src="https://your-site.sirv.com/photos/sunset.jpg?format=optimal&q=auto">

Performance Considerations

HDR images are typically larger:

VersionFormatSize
SDRAVIF 65%95 KB
HDRAVIF 65%140 KB

Loading Strategy

const isHDR = window.matchMedia('(dynamic-range: high)').matches;
const imageSrc = isHDR ? '/hero-hdr.avif' : '/hero-sdr.avif';

const link = document.createElement('link');
link.rel = 'preload';
link.as = 'image';
link.href = imageSrc;
document.head.appendChild(link);

Best Practices

1. Always Provide Fallbacks

<picture>
  <source media="(dynamic-range: high)" srcset="hdr.avif" type="image/avif">
  <source srcset="sdr.avif" type="image/avif">
  <img src="fallback.jpg" alt="Description">
</picture>

2. Respect User Preferences

@media (prefers-contrast: high) {
  .hero {
    background-image: url('hero-sdr.jpg');
  }
}

3. Test on Real Devices

Test on iPhone 12+, MacBook Pro with XDR display, and HDR monitors with proper calibration.

Conclusion

HDR on the web is becoming practical:

  1. AVIF is the best format for HDR web images today
  2. Detect capabilities with CSS media queries and JavaScript
  3. Always provide fallbacks for SDR displays
  4. Use CDNs like Sirv to simplify delivery
  5. Test on real devices - emulation has limitations

Related Resources

Format References

Ready to optimize your images?

Sirv automatically optimizes, resizes, and converts your images. Try it free.

Start Free Trial