CLS in Core Web Vitals: What It Is and How to Improve It

CLS in Core Web Vitals: What It Is and How to Improve It

CLS in Core Web Vitals stands for Cumulative Layout Shift. It scores how much visible content moves around on its own while someone uses a page, like a button sliding away just as you tap it. Google asks for a CLS of 0.1 or less, measured at the 75th percentile of real page loads. Between 0.1 and 0.25 needs improvement, and anything above 0.25 is poor.

This guide goes beyond the definition. You will see why CLS matters, how the score is calculated, which tools measure it, how to fix the usual causes, and how it fits next to LCP and INP, the other two Core Web Vitals.

Nostra AI runs speed and QA agents at the edge of ecommerce storefronts, where promo bars, review widgets, and consent banners make layout shift a common problem. The advice below applies to any site, with storefront examples where they help.

Why CLS matters for visitors and rankings

CLS matters because it measures the moment a page lets a visitor down. They aim at one thing and the page moves it. A page can load fast and still feel broken, which is why Google treats visual stability as its own Core Web Vital next to loading and responsiveness.

What layout shift costs your visitors

Unexpected movement makes people lose their place while reading, tap the wrong link, or press the wrong button. On a storefront the cost is concrete. A promo bar injected after load pushes the product grid down, and the shopper opens a product they never chose. A review widget arrives late, and "Add to cart" slides away from a thumb that was already moving.

A smartphone shows a product grid pushed down by a late promo bar.

Developers rarely see this in testing. Images sit in your browser cache, local API calls return in milliseconds, and third-party content behaves differently than in production. Real visitors on slower phones and networks get content that arrives after the first paint, so the shift happens on their screen, not yours. That gap is why CLS is judged on field data.

A layout shift only hurts when the visitor did not expect it, and nobody expects a banner to land under their thumb.

What CLS means for search rankings

Google's ranking systems use Core Web Vitals as part of their assessment of page experience, and Google recommends that site owners aim for good scores. Its Core Web Vitals documentation also says that good page experience does not override relevant content. Relevance still comes first.

So set honest expectations. Fixing CLS alone will not lift a page with weak content, but a stable layout protects conversions and removes a handicap when two pages answer a query equally well. Treat CLS as a quality fix first and a ranking input second.

How CLS is calculated and what counts as a good score

CLS is the largest burst of layout shift scores that happens during a page's life, and a good score is 0.1 or less. The browser scores every unexpected shift, groups shifts that happen close together, and reports the worst group.

The three CLS ratings

Google rates CLS at the 75th percentile of page loads, split by mobile and desktop. That means three out of four visits need a score of 0.1 or lower for the page to be good.

Rating CLS score
Good 0.1 or less
Needs improvement Above 0.1 up to 0.25
Poor Above 0.25

The thresholds are generous, but aim for 0 on key templates. A shift that stays inside the good range can still move the line someone is reading.

How one layout shift is scored

A layout shift happens when a visible element changes its start position between two rendered frames. The score for that shift is the product of two fractions.

A viewport frame shows a content block at two positions with a ruler measuring the distance.

layout shift score = impact fraction * distance fraction

The impact fraction is the share of the viewport covered by the moved elements, counting both their old and new positions. The distance fraction is the farthest any element moved, divided by the larger viewport dimension. Here are three worked examples.

Scenario Impact fraction Distance fraction Score
Half-screen element shifts down by 25% of viewport height 0.75 0.25 0.1875
Box partly pushed out of view, moves about 14% 0.5 0.14 0.07
Sorted list gets new items, last item moves 30% 0.60 0.3 0.18

Only elements that change their start position count. A new element added to the page, or an element that grows, is not a shift unless it pushes other visible elements.

Why only the largest burst counts

Shifts less than one second apart join into one session window, which lasts at most five seconds. CLS reports the window with the highest total, not the sum of the whole visit.

Take a page where a banner causes a 0.07 shift and an ad then causes a 0.18 shift half a second later. They share a window, so CLS is 0.25, which still needs improvement. If the ad arrived three seconds later, the windows would be separate and CLS would be 0.18.

CLS is a worst-moment score, so one late ad can decide the whole page.

Shifts that do not count

Shifts within 500 milliseconds of a tap, click, or key press are excluded, because the visitor caused them. Opening a menu or expanding an accordion is fine as long as the change happens right next to the interaction. If an action triggers a slow request, reserve space and show a loading indicator immediately. Otherwise the result lands later and moves things unexpectedly.

How to measure CLS in the field and the lab

Measure CLS with field data first, because Google's assessment uses real Chrome visits, then use lab tools to find the cause. The two answer different questions. Field data tells you whether you have a problem, and lab data tells you why.

Field data decides whether you pass

Google's Core Web Vitals data comes from the Chrome User Experience Report (CrUX), which covers the last 28 days of real visits. You see it in the top section of PageSpeed Insights and in the Core Web Vitals report in Search Console, under Experience. Search Console groups similar URLs, which usually means one template per group, and rates each group by its worst metric.

A URL passes the assessment only when LCP, INP, and CLS are all good at the 75th percentile. Mobile and desktop are rated separately, so check the mobile tab first. Pages with too little Chrome traffic have no CrUX data, and the 28-day window means a fix takes a few weeks to show fully.

Fix on a Tuesday, and the Search Console report still shows mostly the old site two weeks later.

Lab tools help you find the cause

Lab tools load a page once under controlled conditions. They are repeatable, which makes them good for debugging.

  • Lighthouse: flags layout shifts during the load and names the elements involved.
  • Chrome DevTools Performance panel: records a load and marks each shift on the timeline.
  • PageSpeed Insights: runs a Lighthouse test beneath the field data.
  • WebPageTest: runs tests on chosen devices and connections.

Lab runs mostly capture what happens during load. A consent banner that appears after five seconds, or content that loads as people scroll, can hit field CLS without showing up in a lab test. When the numbers disagree, trust the field.

Measuring CLS in your own code

If you run your own monitoring, Google's web-vitals library handles the edge cases for you. It reports CLS whenever the page is backgrounded or unloaded, and it resets the value after a back/forward cache restore, because users see that as a new visit.

import {onCLS} from 'web-vitals';

onCLS(console.log);

Shifts inside iframes count toward the metric even though the browser API does not report them to the parent page. That is one reason your own numbers can differ from CrUX. Google documents the metric in detail on web.dev.

How to fix the most common CLS causes

Fix CLS by reserving space before content arrives and by never inserting content above what the visitor is already reading. Nearly every shift comes from an element that showed up without a place waiting for it.

A hub diagram with four branches for the main fixes that reduce layout shift.

Reserve space for images, video, and embeds

Give every image and video explicit dimensions so the browser can hold the space before the file downloads. Width and height attributes let the browser compute the aspect ratio. CSS aspect-ratio does the same for containers and embeds.

<img src="hero.jpg" width="1200" height="600" alt="Product hero">

.video-embed { aspect-ratio: 16 / 9; }

On responsive layouts, keep the attributes and let CSS scale the image. The ratio is what matters, not the pixel size.

Contain ads, banners, and app widgets

Ads, cookie banners, review widgets, and recommendation carousels are the usual storefront culprits. Give each one a fixed-height slot sized for the largest creative you expect, and keep the slot even when nothing fills it.

.ad-slot { min-height: 250px; }

Show consent banners as a fixed overlay at the screen edge, so they do not push the page down. Never insert a promo bar above content that has already rendered. If a widget loads late, give its container a placeholder height close to the final one. Google's Publisher Tag guidance covers ad slots in detail.

Stop font swaps from moving text

A web font that renders larger or smaller than its fallback reflows the text when it swaps in. font-display: swap alone keeps that shift. Size the fallback to match the web font with metric overrides, and preload the one or two fonts used above the fold.

@font-face {
  font-family: "Body Fallback";
  src: local("Arial");
  size-adjust: 104%;
  ascent-override: 92%;
}

The values above are examples. Tune them until the fallback and the web font occupy the same space.

Animate with transform

Animations are fine when they are gradual and tied to a user action. Animate with transform: scale() instead of changing height and width, and use transform: translate() instead of changing top, left, right, or bottom. Transforms do not trigger layout shifts. Respect the prefers-reduced-motion setting too.

Every fix above comes down to one rule: decide where an element lives before it exists.

How CLS relates to LCP and INP

CLS measures stability, LCP measures loading, and INP measures responsiveness, and a page needs all three in the good range to pass. They are separate metrics, but the same page elements often affect more than one.

The three metrics side by side

Metric What it measures Good Poor
LCP (Largest Contentful Paint) Time until the largest image or text block in the first screen renders 2.5 s or less Above 4 s
INP (Interaction to Next Paint) Time from a tap, click, or key press to the next painted frame 200 ms or less Above 500 ms
CLS (Cumulative Layout Shift) How much visible content moves unexpectedly 0.1 or less Above 0.25

INP replaced First Input Delay on March 12, 2024. Older guides that still list FID as the third vital are out of date. For LCP, the usual first suspects are the hero image and the main heading.

Where LCP and CLS interact

LCP and CLS often share a cause. A hero image without dimensions both renders late and pushes content down when it arrives. Marking the hero loading="lazy" delays it further, so keep lazy loading for images below the fold. Putting the hero in the HTML with width, height, and fetchpriority="high" helps both metrics.

They can also trade off. Reserving space guarantees a CLS of 0, but if the image arrives late, LCP is still slow. Fix the loading path and the layout together, then retest both.

Check LCP and CLS together, because a fix for one can quietly break the other.

What a speed agent can and cannot do for CLS

A fast server gives LCP a head start. Dash, Nostra AI's speed agent, caches a store's HTML at the edge, which Nostra reports improves Time to First Byte by 5 to 10x and makes page loads 20 to 30 percent faster on average. It deploys with a DNS-level change and no code changes, and customers typically see Core Web Vitals improve within 14 to 28 days.

Be clear about the limit. Faster delivery does not remove a banner that pushes content down. CLS fixes live in your markup and CSS. After releases, a QA agent like Patch can walk the customer journey on real desktop and mobile devices and file usability bugs with reproduction steps and video, which helps you catch visible breakage early.

Stable layouts start with reserved space

CLS in Core Web Vitals is a worst-burst score of unexpected movement, and 0.1 or less at the 75th percentile is the target. You calculate it from impact and distance, read it in field data, and debug it in the lab. Most fixes are the same few habits: dimensions on media, fixed slots for ads and widgets, matched fallback fonts, and transform-based animation.

Check CLS together with LCP and INP, since you only pass when all three are good. Once your fixes are live, make sure the numbers you read are clean. If bots inflate sessions and muddy the analytics you use to judge results, see how Edge Protect filters bad bot traffic before it reaches your storefront.