Skip to content
Hosting Operations10 min read

How to Improve Core Web Vitals in 2026: Practical Guide

Step-by-step guide to optimize LCP, INP, and CLS. Practical techniques for faster page loads, better interactivity, and stable layouts.

Written by Abdul AbrorTechnical Hosting Support Engineer
a rack of electronic equipment in a dark room
On this page

TL;DR — Key takeaways

  • Core Web Vitals measure loading speed (LCP), interactivity (INP), and visual stability (CLS), directly affecting Google rankings and user experience.
  • Optimize LCP by serving critical resources first using priority hints, preloading key assets, and implementing efficient image formats like WebP or AVIF.
  • Reduce INP by minimizing JavaScript execution time, breaking up long tasks, and deferring non-critical scripts to keep the main thread responsive.
  • Fix CLS by reserving space for dynamic content with explicit width and height attributes, avoiding layout shifts from ads or embeds.
  • Test changes incrementally in staging environments and monitor real-user metrics through tools like PageSpeed Insights or Chrome User Experience Report.

Core Web Vitals are Google's standardized metrics for measuring page experience. They consist of three performance indicators: Largest Contentful Paint (LCP) for loading speed, Interaction to Next Paint (INP) for responsiveness, and Cumulative Layout Shift (CLS) for visual stability. These metrics directly impact search rankings and user satisfaction.

This guide walks through practical optimization techniques for each Core Web Vital. You'll learn how to identify bottlenecks, implement fixes safely, and verify improvements using real-world testing tools. Each step includes rollback guidance for production environments.

Understanding Core Web Vitals Metrics

Core Web Vitals consist of three measurable aspects of page performance. Largest Contentful Paint (LCP) measures how long it takes for the largest visible content element to render, with a target of 2.5 seconds or less. Interaction to Next Paint (INP) tracks responsiveness by measuring the time between user interactions and the next visual update, targeting 200 milliseconds or better. Cumulative Layout Shift (CLS) quantifies visual stability by scoring unexpected layout movements, aiming for 0.1 or lower.

These metrics are collected from real users through the Chrome User Experience Report (CrUX) and factor into Google's page experience ranking signal. Poor scores can reduce organic visibility, while good scores improve rankings and user retention. The 75th percentile of page loads is used for scoring, meaning 75% of users must experience good performance.

  • LCP target: 2.5 seconds or less for the largest visible content element
  • INP target: 200 milliseconds or less for user interaction response time
  • CLS target: 0.1 or lower for cumulative layout shift score
  • Scoring uses the 75th percentile of real-user data from field measurements

Optimizing Largest Contentful Paint (LCP)

LCP measures loading performance by tracking when the largest content element becomes visible. Common LCP elements include hero images, video thumbnails, or large text blocks. Slow LCP typically results from server response delays, render-blocking resources, or inefficient resource loading.

Start by identifying your LCP element using PageSpeed Insights or Chrome DevTools. Open DevTools, go to the Performance panel, record a page load, and look for the LCP marker. Once identified, optimize the delivery path for that specific resource.

Use priority hints to tell the browser which resources matter most. Add fetchpriority='high' to critical images or preload tags. For example: <link rel='preload' as='image' href='/hero.webp' fetchpriority='high'>. This ensures critical resources load before less important ones.

Implement modern image formats like WebP or AVIF, which provide better compression than JPEG or PNG. Use responsive images with srcset to serve appropriately sized versions. Add explicit width and height attributes to prevent layout shifts during loading.

  • Identify your LCP element using PageSpeed Insights or Chrome DevTools Performance panel
  • Add fetchpriority='high' to critical LCP images or preload them explicitly
  • Convert images to WebP or AVIF format for 25-35% smaller file sizes
  • Use CDN caching and optimize server response time to under 600ms
  • Defer non-critical third-party scripts that block initial rendering

Reducing Interaction to Next Paint (INP)

INP replaced First Input Delay (FID) as the interactivity metric in 2024. It measures the time from user interaction (click, tap, keypress) to when the browser can paint the next frame. High INP indicates the main thread is blocked by long-running JavaScript tasks.

Identify slow interactions by using Chrome DevTools or the Web Vitals extension. Navigate to the Performance panel, interact with your page, and look for long tasks marked in red. Tasks over 50ms block the main thread and delay responsiveness.

Break up long tasks by yielding control back to the browser periodically. Use setTimeout() or scheduler.yield() to split work into smaller chunks. For example, instead of processing 1000 items synchronously, process 50 at a time with breaks between batches.

Defer non-critical JavaScript using the defer or async attributes on script tags. Move analytics, chat widgets, and tracking scripts to load after page interaction. Use code splitting to load JavaScript only when needed rather than bundling everything upfront.

  • Use Chrome DevTools Performance panel to identify JavaScript tasks over 50ms
  • Break long tasks into smaller chunks using setTimeout() or scheduler.yield()
  • Add defer or async attributes to non-critical third-party scripts
  • Implement code splitting to load JavaScript modules on demand
  • Minimize main thread work during user interactions by offloading to Web Workers

Fixing Cumulative Layout Shift (CLS)

CLS measures visual stability by scoring unexpected layout movements during page load. Common causes include images without dimensions, dynamically injected content, web fonts causing text reflow, and ads or embeds that push content down after loading.

Reserve space for all content by adding explicit width and height attributes to images and video elements. Modern browsers use aspect ratio calculations to prevent layout shifts even when images are responsive. For a 1200x800 image, add width='1200' height='800' and use CSS to make it fluid.

Handle web fonts carefully to prevent invisible or shifting text. Use font-display: swap in your @font-face declarations to show fallback text immediately, or use font-display: optional to only apply custom fonts if they load quickly. Preload critical fonts using <link rel='preload' as='font'> to reduce delay.

Avoid inserting content above existing content unless triggered by user interaction. If ads or dynamic content must load, reserve space using min-height in CSS or placeholder elements. Never inject content that pushes down content the user is viewing.

  • Add explicit width and height attributes to all images and video elements
  • Use font-display: swap or font-display: optional to prevent text reflow
  • Reserve space for ads and embeds using min-height or placeholder containers
  • Avoid inserting content above the fold after page load
  • Preload critical web fonts to reduce font-loading delays

Testing and Monitoring Core Web Vitals

Test changes in a staging environment before deploying to production. Use lab tools like PageSpeed Insights, Lighthouse in Chrome DevTools, or WebPageTest for synthetic testing. These tools provide controlled measurements and specific recommendations.

Monitor real-user metrics using field data from Google Search Console, Chrome User Experience Report, or Real User Monitoring (RUM) tools. Field data reflects actual user experiences across different devices, networks, and geographies, which often differs from lab conditions.

Implement the web-vitals JavaScript library to capture metrics directly from your users. Add event listeners to send data to your analytics platform: import {onLCP, onINP, onCLS} from 'web-vitals'; then log or send each metric when triggered.

Set up alerts for metric regressions. Monitor the 75th percentile values weekly and investigate sudden changes. Compare before-and-after metrics for each optimization to validate improvements. Keep baseline measurements before making changes.

  • Run PageSpeed Insights or Lighthouse in Chrome DevTools for initial audits
  • Check Google Search Console Core Web Vitals report for real-user field data
  • Implement the web-vitals JavaScript library to capture metrics from actual users
  • Compare metrics before and after each change to validate improvements
  • Monitor the 75th percentile values weekly and set up regression alerts

Advanced Optimization Techniques

Implement partial hydration for JavaScript frameworks like React or Vue. Instead of hydrating the entire page at once, hydrate interactive components on demand when users scroll to them or interact with the page. This reduces initial JavaScript execution and improves INP.

Use resource hints strategically. Add dns-prefetch for third-party domains to resolve DNS early: <link rel='dns-prefetch' href='https://analytics.example.com'>. Use preconnect for critical third-party resources that need full connection setup including TLS handshake.

Enable server-side rendering (SSR) or static site generation (SSG) to deliver pre-rendered HTML. This improves LCP by showing content immediately without waiting for JavaScript execution. Frameworks like Next.js, Nuxt, and Astro provide built-in SSR and SSG capabilities.

Optimize hosting infrastructure by using HTTP/2 or HTTP/3 for multiplexing, enabling Brotli compression for text resources, and configuring proper cache headers. Use a CDN to serve static assets from edge locations closer to users.

  • Implement partial hydration to load interactive components on demand
  • Add dns-prefetch or preconnect hints for critical third-party domains
  • Use server-side rendering or static generation to serve pre-rendered HTML
  • Enable HTTP/2 or HTTP/3 and Brotli compression on your server
  • Configure CDN caching for static assets with appropriate cache lifetimes

Quick troubleshooting checklist

  • Run PageSpeed Insights and note your current LCP, INP, and CLS scores
  • Identify your LCP element using Chrome DevTools Performance panel
  • Add fetchpriority='high' to critical images and preload key resources
  • Convert images to WebP or AVIF format and add explicit dimensions
  • Audit JavaScript tasks over 50ms and break them into smaller chunks
  • Add defer or async attributes to non-critical third-party scripts
  • Add explicit width and height attributes to all images and videos
  • Set font-display: swap on custom web fonts and preload critical fonts
  • Reserve space for ads and dynamic content using CSS min-height
  • Test changes in staging and verify improvements with before-and-after metrics
  • Implement web-vitals library to monitor real-user metrics in production
  • Set up weekly monitoring and alerts for metric regressions

FAQ

What are Core Web Vitals and why do they matter?

Core Web Vitals are Google's standardized metrics for measuring page experience: LCP (loading speed), INP (interactivity), and CLS (visual stability). They matter because they directly impact search rankings and user experience. Sites with good Core Web Vitals scores rank higher and retain more users than slow, unresponsive sites.

What is a good LCP score?

A good LCP (Largest Contentful Paint) score is 2.5 seconds or less. This means the largest visible content element should render within 2.5 seconds of when the page starts loading. Scores between 2.5 and 4 seconds need improvement, and anything over 4 seconds is considered poor.

How do I reduce Interaction to Next Paint (INP)?

Reduce INP by minimizing JavaScript execution time on the main thread. Break long tasks into smaller chunks using setTimeout() or scheduler.yield(), defer non-critical scripts with async or defer attributes, and implement code splitting to load JavaScript only when needed. Target an INP of 200ms or less.

What causes Cumulative Layout Shift (CLS)?

CLS is caused by unexpected layout movements during page load. Common causes include images without width and height attributes, web fonts causing text reflow, ads or embeds loading after content, and dynamically injected content that pushes existing content down. Fix CLS by reserving space for all content and adding explicit dimensions.

How do I test Core Web Vitals before deploying changes?

Test Core Web Vitals using lab tools like PageSpeed Insights, Lighthouse in Chrome DevTools, or WebPageTest in a staging environment. Compare before-and-after scores for each change. After deployment, monitor real-user field data from Google Search Console or implement the web-vitals JavaScript library to capture metrics from actual users.

Should I use WebP or AVIF for images?

Use WebP for broad browser support and good compression, or AVIF for even better compression if you can serve fallbacks for older browsers. Both formats are 25-35% smaller than JPEG or PNG. Implement using the picture element with multiple sources, or use a CDN that automatically serves the best format based on browser support.