Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

next/image pictures show up late or load slowly

ErrorThe hero image appears after the rest of the page

Short answer

next/image loads lazily by default, so a hero image near the top waits like any other. Mark the top image loading="eager" or fetchPriority="high". Add sizes so phones do not download desktop widths, and expect the first request for each size to be slower while Next.js optimizes it.

  • Applies to Next.js 15, Next.js 16
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find the image that is the largest above-the-fold element and see how it is declared.

    grep -rn "<Image" app src components --include=*.tsx
  2. 2Match what you see, then jump to its fix

    1. 1The image sits at the top of the page but the browser requests it late.The top image is lazy loadedFix
    2. 2The Network tab shows an image far wider than its box, especially on phones.No sizes prop, so oversized files are downloadedFix
    3. 3A given image is slow once, then fast. AVIF is configured in images.formats.The first request for a size is optimized on demandFix
    4. 4The page layout is stable but the area stays blank until the file arrives.The user sees an empty box while the image loadsFix

What does the error look like?

  • The hero image appears after the rest of the page
  • The first load of each image is slow, later loads are fast

Cause 1 of 4

The top image is lazy loaded

1Check

loading defaults to lazy, which defers the image until it nears the viewport. For an image that is the LCP element that is the wrong default.

grep -rn -E "loading=|fetchPriority|preload" app src components --include=*.tsx

2Fix

Set loading="eager" or fetchPriority="high" on that one image. From Next.js 16 the old priority prop is deprecated in favour of preload, which is meant for a single image that is surely the LCP element.

import Image from 'next/image'

<Image
  src="/hero.jpg"
  alt="Product overview"
  width={1200}
  height={600}
  fetchPriority="high"
/>

3Verify

Reload with the Network tab open: the hero request should start with the HTML, not after scroll.

npm run build && npm run start

Confirmed by nextjs.org

Did this fix it?

Cause 2 of 4

No sizes prop, so oversized files are downloaded

1Check

If sizes is missing, the browser assumes the image is as wide as the viewport (100vw). That applies to fill images and to images made responsive with CSS.

grep -rn -E "fill|sizes=" app src components --include=*.tsx

2Fix

Describe the real rendered width at each breakpoint.

<Image
  fill
  src="/example.png"
  alt="Example"
  sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
/>

3Verify

Compare the downloaded width in the Network tab on a narrow viewport before and after.

npm run build && npm run start

Confirmed by nextjs.org

Did this fix it?

Cause 3 of 4

The first request for a size is optimized on demand

1Check

The first request for an image can be slower while it is optimized. AVIF takes about 50 percent longer to encode than WebP, and each format is cached separately.

grep -n -A3 "images" next.config.*

2Fix

Keep only the formats you need, and give optimized images a longer cache life with minimumCacheTTL. Remember there is no cache invalidation, so keep the value reasonable.

// next.config.js
module.exports = {
  images: {
    formats: ['image/webp'],
    minimumCacheTTL: 14400,
  },
}

3Verify

Load the page twice in a production build; the second load of each image should be fast.

npm run build && npm run start

Confirmed by nextjs.org

Did this fix it?

Cause 4 of 4

The user sees an empty box while the image loads

1Check

The default placeholder is empty. A blurred placeholder improves how fast the page feels. Static imports of jpg, png, webp and avif get blurDataURL automatically; remote images need one you provide.

grep -rn "placeholder" app src components --include=*.tsx

2Fix

Use placeholder="blur". For a statically imported file nothing else is needed.

import Image from 'next/image'
import hero from './hero.jpg'

<Image src={hero} alt="Hero" placeholder="blur" />

3Verify

Throttle the network in dev tools and watch the blurred preview appear first.

npm run dev

Confirmed by nextjs.org

Did this fix it?

How do I stop it coming back?

  • Mark only one image per page as high priority; marking all of them removes the benefit.
  • Always set sizes for fill images and CSS-responsive images.
  • Use static imports for local pictures so Next.js hashes and caches them for a long time.
  • Test performance on a production build, not in development.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.