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
- responsive images — Offering several sizes of the same image so each device downloads the smallest one that still looks sharp.
- priority prop — A next/image prop that marks an image as important so it is preloaded and not lazy-loaded.
- Cumulative Layout Shift — A Core Web Vitals score measuring how much visible content unexpectedly jumps while a page loads.
- WebP — A modern image format from Google that is usually much smaller than older photo formats or PNG at the same quality.
- AVIF — A newer image format that often compresses even smaller than WebP, at the cost of slower encoding.
Taught in
- Image & Font Optimization: Zero Layout Shift Assets — Next.js 15 & Modern App Router Architecture