Image optimisation is mostly about dimensions, format and priority. A modern format with the wrong sizes attribute can still download a desktop image on a phone; a compressed hero can still be the LCP bottleneck if it loads late.
Key takeaways
- Target: Serve the smallest correct image for each viewport, without delaying the hero.
- Measure field data before choosing a fix.
- Change one bottleneck at a time and re-measure on a mid-range phone.
- A fast lab score is not a substitute for real-user data.
What Image optimisation measures
Compare the intrinsic image size with the rendered size, check the format and compression, and inspect the network waterfall for the hero. Use Lighthouse or WebPageTest to see which image is the LCP.
The fixes that usually move the number
- Use
next/imageor a CDN that can resize and convert to AVIF/WebP. - Provide an accurate
sizesvalue for responsive images. - Set
priorityonly on the hero image. - Set explicit dimensions or
fillwith a sized container. - Lazy-load below-the-fold images and keep the hero eager.
Symptom, cause and fix
| Symptom | Likely cause | What to do |
|---|---|---|
| Phone downloads a desktop image | Wrong sizes or no responsive source | Add accurate sizes and a responsive loader |
| Hero loads late | Lazy loading or no priority | Mark the hero priority, preload it if needed |
| Large PNGs | Uncompressed source | Convert to AVIF/WebP and set a quality budget |
| Images shift the layout | No dimensions | Set width/height or an aspect-ratio container |
How to measure it properly
- Find the LCP image. Use PageSpeed Insights and the Performance panel.
- Check the delivered size. Compare the actual bytes with the rendered dimensions.
- Check the format. Confirm the CDN is serving AVIF or WebP where supported.
- Test a mobile viewport. Use a 390px-wide device and a throttled connection.
- Measure again. Compare LCP and total image bytes after the change.
A practical example
<Image
src="/product.webp"
alt="Product dashboard"
width={1200}
height={800}
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 600px"
priority
/>
Common mistakes
- Using
layout="fill"without a positioned, sized parent. - Setting
priorityon every image. - Forgetting
alttext or using the filename as alt text. - Optimising the logo while a 4MB hero dominates LCP.
A 30-day improvement plan
- Week 1. Collect field data and pick the worst route. Write down the baseline.
- Week 2. Fix the largest bottleneck and deploy behind a normal release.
- Week 3. Test on a mid-range phone and a throttled connection; fix regressions.
- Week 4. Compare field data, document the change and add a monitor or budget.
Field data vs lab data
| Source | What it tells you | How to use it |
|---|---|---|
| Field data | What real users experienced | The source of truth for the metric |
| Lab test | A reproducible diagnosis | Find the cause and test a fix |
| Synthetic monitoring | Availability and regressions over time | Alert on a budget breach |
| RUM segmentation | Device, country and route differences | Target the worst segment |
| Server timing | Database, cache and render time | Separate backend from frontend |
Set a performance budget
| Budget | Example starting point | Why |
|---|---|---|
| LCP | 2.5s or less at p75 | The main content must appear quickly |
| INP | 200ms or less at p75 | Interactions must feel responsive |
| CLS | 0.1 or less at p75 | Layout movement erodes trust |
| JavaScript | A route-level KB budget | Prevents bundle creep |
| Images | Responsive sizes and modern formats | The largest common payload |
| Third-party scripts | A named owner and a cap | Uncontrolled tags are a common regression |
Third-party script policy
- Every script needs an owner, a purpose and a review date.
- Load analytics and marketing tags after consent and after the main content.
- Prefer server-side events where they reduce client JavaScript.
- Test the checkout and sign-up with the full tag set enabled.
- Remove tags that no longer answer a business question.
Frequently asked questions
The target is Serve the smallest correct image for each viewport, without delaying the hero. A single fast test is not enough; use the 75th percentile of real page views and segment by mobile and desktop.
No. Start with the routes that matter to revenue or support: checkout, pricing, sign-up, the main product page and the most-read blog template. A fast homepage with a slow checkout is not a fast site.
It depends on traffic. Low-traffic sites can take weeks to accumulate enough data. Use lab tools for immediate feedback, but keep the field metric as the source of truth.
Often yes. Image dimensions, priority, bundle splits, caching and third-party scripts usually deliver more than a visual refresh. Redesign only after the measurement shows the layout itself is the bottleneck.
Sources and further reading
- Next.js image optimisation (nextjs.org)
- Image optimisation (web.dev)
- Optimise Largest Contentful Paint (web.dev)
Related reading
Need a performance audit?
Send the URL and the metric that matters. I will identify the bottleneck, the likely fix and the cheapest way to prove it worked.
How to cite this guide: Nur Hossain Repon, “Image Optimization Guide for Next.js and React Apps”, Nhrepon Portfolio, reviewed October 2026, https://nhrepon.com/posts/image-optimization-guide-for-next-js-and-react-apps.





Comments
No comments yet.