0%|
~5 min left

Web Development5 min read

Next.js Image Component Mistakes That Hurt Performance

The Next.js Image component is one of the framework's best features — automatic resizing, modern formats, lazy loading. Yet in almost every Next.js audit, I find it misused in ways that actively hurt performance.

Abdul SubhanDigital marketing & web development

Next.js Image Component Mistakes That Hurt Performance

The Next.js Image component (next/image) is one of the framework's best features — automatic resizing, modern formats, lazy loading. And yet, in almost every Next.js audit I do, I find it misused in ways that actively hurt performance. Here are the seven mistakes I keep finding, and the fixes.

Mistake 1: No priority on the hero image

I covered this in my LCP article, but it belongs here too because it's that common. The Image component lazy-loads by default. That's correct for below-the-fold images and dead wrong for your hero.

// Wrong: hero image lazy loads
<Image src="/hero.jpg" alt="Hero" width={1600} height={900} />

// Right: hero image preloads
<Image src="/hero.jpg" alt="Hero" width={1600} height={900} priority />

One prop. Check every page's largest above-the-fold image right now.

Mistake 2: Using fill without sizes

When you use fill, the image expands to fill its parent container. That's convenient for responsive layouts — and it's a performance trap if you skip the sizes attribute.

Without sizes, the browser doesn't know how large the image will display, so it defaults to downloading a large version — often 100vw worth of pixels even when the image renders at 400px wide. On mobile, this is brutal: a tiny thumbnail triggering a 1600px download.

// Wrong
<Image src="/card.jpg" alt="Card" fill />

// Right
<Image
  src="/card.jpg"
  alt="Card"
  fill
  sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
/>

The sizes value should mirror your actual CSS layout. If the image is half the viewport on desktop and full-width on mobile, say so. Take two minutes per image — it compounds across every pageview.

Mistake 3: Serving PNGs where WebP would do

Next.js automatically serves modern formats (WebP, AVIF) when the browser supports them — but only if you let it. I've seen projects where someone set unoptimized globally "to fix a bug" and left it, which disables all of Next.js's image optimization including format conversion.

Check your next.config.js. Unless you have a specific reason (like an external image loader handling optimization), unoptimized should not be on. The automatic AVIF/WebP conversion typically cuts image weight by 25–40% with no visible quality change.

Mistake 4: Oversized source images

Next.js resizes images on demand, which leads to a lazy habit: uploading a 6000px original "because Next.js will handle it." It will — but the first request for each size pays the resize cost, and you're storing and processing far more data than needed.

My rule: source images should be at most 2x the largest size they'll display. A hero that maxes out at 1600px wide gets a 3200px source at most. Anything beyond that is wasted bytes and wasted processing.

Mistake 5: Forgetting alt text (and hurting SEO)

This one's not performance, but I see it in the same audits. Empty or missing alt attributes on content images. Alt text matters for accessibility and gives Google context about the image — which feeds into image search traffic.

Write alt text like you're describing the image to someone who can't see it. Not keyword stuffing. "Team reviewing website analytics dashboard" beats "web development services best agency 2026."

Mistake 6: Lazy-loading images inside carousels

Carousels and image galleries break the lazy-loading heuristic. The Image component can't know which slide the user will view, so non-active slides either load eagerly (wasteful) or lazily (janky when the user swipes to a not-yet-loaded image).

What I do: eager-load the first slide (with priority if it's the LCP element), and lazy-load the rest but with a generous root margin so they start loading before the user swipes. For galleries, consider preloading the next image on slide change. It's a small amount of JavaScript for a much smoother experience.

Mistake 7: External images without a loader configuration

next/image optimizes images from your own domain out of the box. External images — from a CMS, S3 bucket, or CDN — need to be allowlisted in remotePatterns, and ideally served through a loader that can resize them.

// next.config.js
images: {
  remotePatterns: [
    { protocol: 'https', hostname: 'cdn.example.com' },
  ],
},

Without this, external images either fail to load or bypass optimization entirely. I've debugged "images are slow" complaints that traced back to a CMS migration where nobody updated remotePatterns — every image was falling back to the raw multi-megabyte original.

Bonus: the quality prop is not free performance

The Image component defaults to 75 quality, which is a sensible balance. I've seen developers drop it to 30 thinking "lower number, faster site" — and end up with visibly crunchy product photos that hurt trust more than the saved kilobytes help speed.

Go the other direction carefully too: bumping quality to 100 for "crispness" roughly doubles file size for a difference most visitors can't see on a phone screen. The default of 75 exists for a reason. Change it only for specific images where you've compared the output visually — hero images sometimes justify 80–85, thumbnails can go lower.

My audit checklist for next/image

When I review a Next.js site's images, I check:

  • Hero/LCP image has priority
  • Every fill image has an accurate sizes attribute
  • unoptimized is not set globally without reason
  • Source images are max 2x display size
  • All content images have descriptive alt text
  • Carousel images: first eager, rest lazy with margin
  • External domains in remotePatterns

Run through this on your site. I'd bet you find at least two of these — most sites I audit have three or four. The fixes are small, the performance gains aren't. And once the images are sorted, run a fresh PageSpeed test: image issues are so often the dominant factor that everything else gets easier to diagnose afterwards.

Work With Me

Ready to Apply These Strategies to Your Business?

I engineer high-converting web apps, scalable ad campaigns, and brand identity systems that produce measurable results.

  • 100% IP & asset ownership
  • Clear sprint milestones
  • Direct communication