Next

How to optimize images with next/image and AVIF on edge in Next.js?

November 28, 2025

download ready
Thank You
Your submission has been received.
We will be in touch and contact you soon!

Next.js next/image automatically generates AVIF/WebP formats with edge-optimized delivery via Vercel Image Optimization, reducing sizes 30-50%. Configure deviceSizes, imageSizes, and sizes prop for responsive loading; set priority for LCP images and fill for full-bleed. Edge caching serves from global CDN with <100ms TTFB.

Example:-

Code

import Image from 'next/image';

// Responsive hero
<Image
  src="/hero.jpg"
  alt="Hero image"
  width={1200}
  height={600}
  priority
  sizes="(max-width: 768px) 100vw, (max-width: 1200px) 90vw, 1200px"
  style={{ objectFit: 'cover' }}
/>

// Full viewport fill
<Image
  src="/background.jpg"
  alt="Background"
  fill
  sizes="100vw"
  className="object-cover"
/>
      
Hire Now!

Need Help with Next Development ?

Work with our skilled next developers to accelerate your project and boost its performance.
**Hire now**Hire Now**Hire Now**Hire now**Hire now

How to optimize images with next/image and AVIF on edge in Next.js?

Next.js next/image automatically generates AVIF/WebP formats with edge-optimized delivery via Vercel Image Optimization, reducing sizes 30-50%. Configure deviceSizes, imageSizes, and sizes prop for responsive loading; set priority for LCP images and fill for full-bleed. Edge caching serves from global CDN with <100ms TTFB.

Example:-

Code

import Image from 'next/image';

// Responsive hero
<Image
  src="/hero.jpg"
  alt="Hero image"
  width={1200}
  height={600}
  priority
  sizes="(max-width: 768px) 100vw, (max-width: 1200px) 90vw, 1200px"
  style={{ objectFit: 'cover' }}
/>

// Full viewport fill
<Image
  src="/background.jpg"
  alt="Background"
  fill
  sizes="100vw"
  className="object-cover"
/>