← Back to all posts

Why Use Image Instead of img

Images are heavy. They slow down websites if you don’t optimize them. Next.js gives you the Image component, which automatically:

  • Compresses and serves images in modern formats (like WebP).
  • Resizes images for different screen sizes.
  • Lazy loads images (they load only when visible).
  • Uses caching to avoid re‑fetching.

Core Props You Should Know

Here are the main props you’ll use most often:

PropWhat it doesExample
srcPath or URL to the imagesrc="/profile.png”
widthImage width in pxwidth={500}
heightImage height in pxheight={500}
altAlt text for accessibilityalt="Profile picture”
fillMakes image fill its parent containerfill
sizesResponsive sizing rulessizes="(max-width: 768px) 100vw”
qualityControl compression (1–100)quality={80}
priorityPreload important imagespriority
placeholderBlur or empty placeholderplaceholder="blur”

Example: Basic Usage

import Image from "next/image";

export default function Profile() {
  return (
    <Image
      src="/profile.png"
      width={400}
      height={400}
      alt="Picture of me"
      priority
    />
  );
}

👉 This will serve an optimized, cached, responsive image automatically.

Example: Responsive Fill

<Image
  src="/cover.jpg"
  alt="Cover photo"
  fill
  sizes="100vw"
  style={{ objectFit: 'cover' }}
/>

👉 The image fills the parent container and adapts to screen size.

Wrap‑Up

The Image component is one of those things that feels small but makes a huge difference. Instead of worrying about compression, formats, or responsive sizes, you just drop in Image and let Next.js handle the heavy lifting.

So if you’re building with Next.js, always reach for Image over img — your users (and Lighthouse scores) will thank you.