How to Fix Cumulative Layout Shift (CLS)
CLS measures unexpected layout shifts—when visible elements move around as the page loads. It's the easiest Core Web Vital to pass: 79% of mobile sites achieve good CLS compared to 59% for LCP.
But "easiest" doesn't mean unimportant. Layout shifts destroy trust. When users click a button and hit an ad instead, or lose their reading position because a banner appeared, they leave.
Redbus reduced CLS from 1.65 to 0 and saw 80-100% higher mobile conversion rates. Visual stability directly impacts revenue.
What is CLS?
Cumulative Layout Shift tracks how much visible content moves unexpectedly. The score is calculated by multiplying two fractions for each shift:
Impact Fraction × Distance Fraction = Layout Shift Score
- Impact fraction: Percentage of viewport affected by the shift
- Distance fraction: Distance elements moved relative to viewport
A small image shifting 50px causes less CLS than a large banner shifting 200px.
CLS Thresholds:
| Score | Rating | What it means |
|---|---|---|
| ≤0.1 | Good | Stable, predictable layout |
| 0.1–0.25 | Needs Improvement | Noticeable shifts, frustrating UX |
| >0.25 | Poor | Severe shifts, users may misclick |
Score Weight: CLS accounts for 25% of your Lighthouse Performance score—tied with LCP for the largest weight.
How CLS is measured: Since April 2021, CLS uses a "session window" approach. It captures the maximum burst of layout shifts with a 1-second gap and 5-second cap. This makes CLS more fair for long-lived pages and SPAs.
User-initiated shifts are excluded: Layout shifts within 500ms of discrete user input (clicks, taps, keypresses) don't count. Scroll and pinch gestures don't trigger this exclusion—those are continuous inputs.
Why CLS Matters
User Experience
Layout shifts cause users to:
- Click the wrong button or link (the infamous "misclick")
- Lose their place while reading
- Accidentally trigger unwanted actions like purchases
- Perceive the site as broken or low-quality
The frustration is visceral. Users don't think "this page has poor CLS"—they think "this site is garbage."
SEO Impact
CLS is one of Google's Core Web Vitals ranking factors. Sites with good CLS can rank higher than competitors with poor CLS, especially for "Top Stories" carousel eligibility.
Google uses field data from the 75th percentile—meaning 75% of your users need good CLS for it to count as "good" for ranking purposes.
Business Impact
| Company | CLS Improvement | Business Impact |
|---|---|---|
| Redbus | 1.65 → 0 | 80-100% higher mobile conversions |
| Yahoo! Japan | 98% reduction | 15% more page views per session |
| AliExpress | 10x improvement | 15% lower bounce rates |
| iCook | 15% improvement | 10% more ad revenue |
The pattern is clear: visual stability correlates with engagement and conversion.
Common CLS Issues
Lighthouse identifies these root causes for layout shifts:
| Issue | Impact | Difficulty |
|---|---|---|
| Images Without Dimensions | High | Low |
| Large Layout Shifts | High | Varies |
| Dynamic Content Injection | High | Medium |
| Web Fonts (FOIT/FOUT) | Medium | Medium |
| Ads, Embeds, iframes | Medium | Medium |
| Animations & Transitions | Low | Low |
The audit tracks up to 15 layout shifts and shows the element that shifted most for each event, along with the root cause (unsized media, web font loaded, or injected iframe).
Try It: Layout Shift Playground
Trigger common layout shifts and see how they affect the CLS score:
How to Measure CLS
Lab Testing (Development)
Lab tests give you controlled, reproducible results—but they capture only shifts during page load, not during longer sessions.
Chrome DevTools:
- Open DevTools → Performance tab
- Click record → reload page → stop recording
- Look for pink "Layout Shift" entries in the timeline
- Click to see which elements shifted and by how much
Lighthouse: Run an audit and check the CLS metric. The "Avoid large layout shifts" diagnostic shows the top shifting elements with their root causes.
Console snippet:
new PerformanceObserver((l) => {
l.getEntries().forEach((e) => {
console.log('CLS:', e.value, e.sources)
})
}).observe({ type: 'layout-shift', buffered: true })
This logs each shift with its source element—useful for catching shifts in real-time during development.
Field Data (Real Users)
Field data captures shifts throughout the user session, not just initial load.
PageSpeed Insights: Shows CrUX data for your URL—the same data Google uses for ranking.
Google Search Console: Core Web Vitals report groups URLs by CLS status.
Web Vitals Chrome Extension: Shows CLS in real-time and highlights shifting elements with red overlays.
Web Vitals JavaScript Library:
import { onCLS } from 'web-vitals'
onCLS((metric) => {
console.log('CLS:', metric.value)
console.log('Entries:', metric.entries)
})
To catch regressions automatically, set up Lighthouse CI in your deployment pipeline.
Lab vs Field CLS
Important: Lab CLS can be artificially lower than field CLS because:
- Lab tests end at "page load" while field data captures shifts throughout the session
- Ads and third-party content may load differently in lab conditions
- User interactions in the field can trigger shifts that lab tests miss
Always verify with real user data. If field CLS is worse than lab, you have shifts happening after initial load—likely from ads, lazy-loaded content, or user interactions.
CLS Progress Over Time
CLS has improved significantly across the web:
| Year | Mobile Good CLS | Desktop Good CLS |
|---|---|---|
| 2020 | 60% | 54% |
| 2022 | 74% | 65% |
| 2024 | 79% | 72% |
Source: HTTP Archive Web Almanac 2024
Mobile sites actually outperform desktop on CLS—likely due to simpler layouts and fewer ads. Desktop pages tend to have more complex layouts with sidebars, multi-column content, and ad placements that shift.
Advanced CLS Insights
Recent research highlights the deeper connection between visual stability, SEO algorithms, and user trust.
Critical SEO Factors
| Insight | Source | Affects |
|---|---|---|
| Robots.txt Blocking | Google Search Central | Googlebot renders your page to check CLS. If robots.txt blocks CSS/JS resources, the bot sees a broken layout with massive shifts that real users might not see. |
| Mobile-First Indexing | Google Developers | Google predominantly uses the mobile version of the content for indexing and ranking. Your mobile CLS score is the primary ranking signal, even for desktop searches. |
| Accessibility Overlap | WCAG 2.1 | Poor CLS violates "Operable" and "Understandable" principles. Users with motor impairments may misclick due to shifts, failing WCAG accessibility criteria alongside Core Web Vitals. |
| "Pogo-sticking" Signal | Industry Studies | When users encounter layout shifts and immediately hit "Back" (pogo-sticking), it sends a strong negative quality signal to Google's ranking algorithms. |
Technical Gotchas
| Gotcha | Impact | Fix |
|---|---|---|
| Late-loading CSS | Flash of Unstyled Content (FOUC) | Ensure critical CSS is inline or loaded in <head>. Async CSS loading without critical CSS extraction guarantees layout shifts. |
| Viewport Meta Tag | Scaling & Layout | Missing <meta name="viewport" content="width=device-width, initial-scale=1"> causes browsers to guess dimensions, often triggering shifts on load. |
| Cookie Banners | 0.1+ CLS Score | Often ignored in development because "I already accepted it." Test in Incognito mode. Banners pushing content down are a top CLS cause. |
Framework Guides
Framework-specific CLS fixes:
Next.js
next/image with dimensions, font optimization with next/font.
Nuxt
NuxtImage sizing, @nuxt/fonts for font loading.
React
Placeholder strategies, Suspense boundary sizing.
Vue
v-if/v-show transitions, async component sizing.
Svelte
enhanced:img dimensions, transition handling.
Angular
NgOptimizedImage with dimensions, @angular/fonts.
Test Your Entire Site
Most tools only test one page at a time. Your homepage might pass CLS while your blog template has unsized images causing shifts on every post.
Unlighthouse scans your entire site and shows CLS scores for every page. The CLI is free and runs locally. Cloud adds scheduled monitoring to catch regressions before users do.
Related
Inspector Issues
Resolve browser-detected problems including mixed content, cookie issues, CSP violations, and cross-origin blocks that appear in Chrome's Issues panel.
Images Without Dimensions
Images without width and height cause layout shifts. Add explicit dimensions to prevent your page from jumping around as images load.