next/image

The Next.js Image component, which resizes, converts and lazy-loads images and reserves their space to prevent layout shift.

In more detail

It needs width and height, a statically imported image or the fill prop so it can reserve the box before the file loads. Images are resized on demand to the sizes a device needs. WebP is the default output; add image/avif to images.formats in next.config to also serve AVIF.

Example

<Image src={hero} alt="Product" priority sizes="(max-width: 768px) 100vw, 50vw" />

Related terms

Taught in

References