Back to results for “Performance & Optimization”
Next.js › Image & Font Optimization

What does the built-in Image component in Next.js do differently from a regular HTML img tag?

Beginner

Answer

The Image component automatically resizes images to fit the size they are displayed at, serves modern efficient formats like WebP when supported, lazy loads images that are not yet visible on screen, and prevents layout shift by reserving the correct amount of space before the image finishes loading.
import Image from 'next/image';

export default function Avatar() {
  return <Image src="/profile.jpg" alt="User profile picture" width={100} height={100} />;
}
Real-world example A photography portfolio site uses the Image component for every photo, dramatically reducing page load times since images are automatically resized and served in efficient modern formats.

Common follow-ups: Why do you need to specify width and height on the Image component?;What happens if an image's actual size on the page changes based on screen size?