Cumulative Layout Shift (CLS) measures the visual stability of a webpage by quantifying how much page content unexpectedly moves during loading. A good CLS score is 0.1 or less. CLS is one of Google’s three Core Web Vitals that affect search rankings, alongside Largest Contentful Paint (LCP) and Interaction to Next Paint (INP).
CLS is critical for user experience because unexpected layout shifts cause users to lose their place, click the wrong buttons, or accidentally interact with ads. This guide explains what causes layout shifts and how to fix them for better technical SEO performance.
Key Takeaways: Cumulative Layout Shift
- Good CLS: 0.1 or less is considered a good score
- Main causes: Images without dimensions, ads, embeds, and late-loading fonts
- Ranking factor: CLS is an active Google Core Web Vital that affects rankings
- Key fix: Always specify width and height attributes on images and videos
- Measurement: Use PageSpeed Insights, Lighthouse, or Search Console to check CLS
8 Ways to Fix Cumulative Layout Shift
- Add width and height attributes to all images and videos
- Reserve space for ads with fixed-size containers
- Preload web fonts and use font-display: swap
- Avoid inserting content above existing content dynamically
- Use CSS aspect-ratio for responsive media elements
- Load embeds with placeholders that match final dimensions
- Avoid late-loading CSS that changes element sizes
- Use transform animations instead of properties that trigger layout
What Is Cumulative Layout Shift?
Cumulative Layout Shift (CLS) is a Core Web Vital metric that measures unexpected layout shifts during the entire lifespan of a page. It calculates how much visible content moves from its original position. CLS uses a unitless score where lower is better: a score of 0 means no shifts occurred, while higher scores indicate more visual instability.
Egochi, America’s #1 digital marketing agency headquartered in New York City, helps businesses optimize Core Web Vitals including CLS. From our offices in NYC, Milwaukee, Madison, and Miami, we’ve helped clients eliminate layout shifts and improve both user experience and search rankings.
What is a good CLS score?
A good CLS score is 0.1 or less. Google considers CLS scores of 0.1 or under as “good,” between 0.1-0.25 as “needs improvement,” and over 0.25 as “poor.” These thresholds are measured at the 75th percentile, meaning 75% of your page loads should have CLS of 0.1 or less to pass. Unlike time-based metrics, CLS is a unitless score calculated from how much content shifts and how far it moves.
What causes Cumulative Layout Shift?
Cumulative Layout Shift is caused by elements that change size or position after the page starts rendering. The most common causes are images without width/height attributes, dynamically injected content (like ads or banners), web fonts that swap and change text size, and iframes or embeds that load with unknown dimensions. Any element that causes other content to move contributes to CLS.
Does CLS affect SEO rankings?
Yes, CLS directly affects SEO rankings as one of Google’s three Core Web Vitals. Google uses CLS as a ranking signal in its page experience algorithm. Sites with poor CLS may rank lower than competitors with stable layouts. Google Search Console shows CLS data for your pages and flags URLs that need improvement.
📈 Cumulative Layout Shift Score Thresholds
How CLS Is Calculated
Impact Fraction
The combined area of the viewport affected by the shift. If 50% of the viewport is affected, the impact fraction is 0.5.
Distance Fraction
How far the elements moved as a fraction of the viewport. If content moves 25% of the viewport height, the distance fraction is 0.25.
Table of Contents
- Why Cumulative Layout Shift Matters for SEO
- What Causes Poor Cumulative Layout Shift
- How to Fix Cumulative Layout Shift
- Code Examples for CLS Optimization
- Before and After CLS Examples
- Tools to Measure Cumulative Layout Shift
- CLS and Other Core Web Vitals
- Technical SEO Services from Egochi
- Frequently Asked Questions
Why Cumulative Layout Shift Matters for SEO
Cumulative Layout Shift directly impacts search rankings and user experience. Google includes CLS in its Core Web Vitals because visual stability strongly correlates with user satisfaction.
User Experience Impact: Layout shifts are one of the most frustrating web experiences. Users lose their reading position, click wrong buttons, or accidentally tap ads when content unexpectedly moves. Studies show layout shifts significantly increase bounce rates and decrease user trust.
Search Ranking Factor: Google uses CLS as a ranking signal. Pages with poor CLS scores may rank lower than competitors with stable layouts. Google Search Console flags pages with CLS issues, and fixing them can improve your search visibility.
Conversion Impact: Layout shifts directly hurt conversions. If your “Add to Cart” button moves just as a user is about to click it, they may click something else entirely or give up in frustration. E-commerce sites with poor CLS see measurably lower conversion rates.
CLS measures shifts throughout the page’s lifetime, not just during initial load. Lazy-loaded images, infinite scroll, and dynamically inserted content can all cause CLS long after the page appears loaded.
What Causes Poor Cumulative Layout Shift
CLS problems occur when elements change size or position after the browser has already started rendering the page. Understanding these causes helps you target the right fixes.
Images Without Dimensions
Images without width and height attributes cause the browser to reserve no space initially. When the image loads, surrounding content shifts to accommodate it.
Dynamically Injected Ads
Ad slots that load after page content push other elements down or sideways. Ads with unknown dimensions are especially problematic.
Web Fonts Loading
When web fonts load and replace fallback fonts, text can reflow if the fonts have different sizes. This causes “Flash of Unstyled Text” (FOUT) shifts.
Embeds and Iframes
Third-party embeds (YouTube, Twitter, maps) often load with unknown dimensions. The browser reserves minimal space until the embed fully loads.
Late-Loading CSS
CSS that loads asynchronously can change element dimensions after initial render. This includes CSS loaded by JavaScript or third-party widgets.
Dynamic Content Injection
Banners, cookie notices, email signup forms, and other content injected above existing content pushes everything down.
Common Mistake
Many developers only test CLS on fast connections with cached resources. Real users on slow connections experience CLS differently because resources load in unpredictable order. Always test with network throttling and cleared cache.
How to Fix Cumulative Layout Shift
Fixing CLS requires reserving space for elements before they load and avoiding dynamic content insertion. These techniques address the root causes of layout shifts.
Add Width and Height to Images
Always include width and height attributes on img and video elements. Modern browsers use these to calculate aspect ratio and reserve space before the image loads.
High ImpactUse CSS Aspect-Ratio
For responsive images, use the CSS aspect-ratio property to maintain proportions while allowing flexible sizing. This reserves the correct space at any viewport width.
High ImpactReserve Space for Ads
Create fixed-size containers for ad slots before ads load. If ad sizes vary, use the largest expected size to prevent shifts when smaller ads appear.
High ImpactPreload Critical Fonts
Use link rel=”preload” for web fonts and font-display: swap in CSS. Preloading ensures fonts arrive early, and swap prevents invisible text while minimizing shift.
Medium ImpactAvoid Above-the-Fold Injection
Never dynamically insert content above existing content. Banners, notices, and alerts should appear below or overlay existing content rather than pushing it down.
High ImpactSize Embed Containers
Wrap iframes and embeds in containers with explicit dimensions matching the expected content size. This reserves space before the third-party content loads.
High ImpactUse Transform for Animations
Animate with transform and opacity instead of properties like width, height, top, or left. Transform animations don’t trigger layout and won’t cause CLS.
Medium ImpactInline Critical CSS
Include critical CSS inline in the document head to ensure initial styles are applied immediately. This prevents style changes after content renders.
Medium ImpactCode Examples for CLS Optimization
Adding Dimensions to Images
Always specify width and height on images. Modern browsers calculate aspect ratio automatically:
<!-- BAD: No dimensions causes layout shift --> <img src="hero.jpg" alt="Hero image"> <!-- GOOD: Dimensions let browser reserve space --> <img src="hero.jpg" alt="Hero image" width="1200" height="600" > <!-- CSS for responsive sizing --> <style> img { max-width: 100%; height: auto; } </style>
Using CSS Aspect-Ratio
/* Reserve space for 16:9 video containers */ .video-container { aspect-ratio: 16 / 9; width: 100%; background: #f0f0f0; } /* Square image container */ .thumbnail { aspect-ratio: 1 / 1; width: 200px; object-fit: cover; }
Reserving Space for Ads
<!-- BAD: Ad container with no size --> <div class="ad-slot"> <!-- Ad loads here and causes shift --> </div> <!-- GOOD: Fixed size container reserves space --> <div class="ad-slot" style="min-height: 250px; width: 300px;"> <!-- Ad loads without causing shift --> </div> <!-- BETTER: Placeholder until ad loads --> <div class="ad-slot"> <div class="ad-placeholder">Advertisement</div> </div> <style> .ad-slot { min-height: 250px; width: 300px; contain: layout; } </style>
Preloading Fonts
<!-- Preload critical web fonts --> <link rel="preload" href="/fonts/opensans.woff2" as="font" type="font/woff2" crossorigin > <!-- Use font-display in CSS --> <style> @font-face { font-family: 'Open Sans'; src: url('/fonts/opensans.woff2') format('woff2'); font-display: swap; /* Shows fallback immediately */ } </style>
Before and After CLS Examples
✗ Poor Practice
Image without dimensions: <img src=”photo.jpg”> causes the page to jump when the image loads because the browser doesn’t know how much space to reserve.
✓ Best Practice
Image with dimensions: <img src=”photo.jpg” width=”800″ height=”600″> lets the browser reserve the exact space needed, preventing any shift.
✗ Poor Practice
Banner above content: Injecting a cookie notice at the top of the page pushes all content down, causing a large layout shift for users already reading.
✓ Best Practice
Fixed or overlay banner: Use position: fixed to overlay the banner at the bottom of the viewport, or reserve space in the initial HTML layout.
✗ Poor Practice
Unsized iframe: <iframe src=”video.html”></iframe> with no dimensions causes major shifts when third-party content like YouTube loads.
✓ Best Practice
Wrapper with aspect-ratio: Wrap iframes in a container with aspect-ratio: 16/9 to reserve space matching the expected video dimensions.
Tools to Measure Cumulative Layout Shift
CLS can be measured with both lab tools (simulated environments) and field tools (real user data). Field data from CrUX is what Google uses for ranking decisions.
PageSpeed Insights
Lab and field CLS data
FreeGoogle Search Console
CLS report for your site
FreeLighthouse
Lab CLS in Chrome DevTools
FreeChrome UX Report
Real user CLS field data
FreeWeb Vitals Extension
Real-time CLS in browser
FreeChrome DevTools
Performance panel CLS tracking
FreeWebPageTest
Detailed filmstrip analysis
FreeSpeedCurve
CLS monitoring over time
PaidMeasuring CLS with JavaScript
Use the web-vitals library to measure CLS on your own site:
// Install: npm install web-vitals import { onCLS } from 'web-vitals'; onCLS((metric) => { console.log('CLS:', metric.value); // Send to your analytics sendToAnalytics({ name: metric.name, value: metric.value, rating: metric.rating, // 'good', 'needs-improvement', 'poor' entries: metric.entries, // Individual shift entries }); });
Debugging Layout Shifts
In Chrome DevTools, open the Performance panel and record a page load. Look for “Layout Shift” entries in the timeline. Click each one to see which elements shifted and by how much. The Experience section also highlights CLS issues.
CLS and Other Core Web Vitals
Cumulative Layout Shift works alongside Largest Contentful Paint (LCP) and Interaction to Next Paint (INP) to measure overall page experience. Optimizing all three creates fast, stable, and responsive pages.
| Metric | Measures | Good Threshold | Primary Fix |
|---|---|---|---|
| LCP | Loading performance | 2.5 seconds | Optimize largest element load |
| INP | Interactivity | 200 milliseconds | Reduce JavaScript blocking |
| CLS | Visual stability | 0.1 | Reserve space for elements |
Optimization Priority: CLS fixes are often the easiest Core Web Vital improvements. Adding image dimensions and reserving ad space can dramatically improve CLS with minimal development effort. LCP and INP typically require more complex optimizations.
Cumulative Layout Shift Optimization Checklist
- ✓ Add width and height attributes to all images
- ✓ Add width and height attributes to all videos
- ✓ Use CSS aspect-ratio for responsive containers
- ✓ Reserve fixed space for ad slots
- ✓ Preload critical web fonts
- ✓ Use font-display: swap for web fonts
- ✓ Size iframe and embed containers
- ✓ Avoid inserting content above existing content
- ✓ Use transform for animations instead of layout properties
- ✓ Inline critical CSS in the document head
- ✓ Test with network throttling and cleared cache
- ✓ Monitor field data in Google Search Console
People Also Ask About Cumulative Layout Shift
What is a bad CLS score?
A CLS score above 0.25 is considered poor. Scores between 0.1 and 0.25 need improvement, while anything above 0.25 indicates significant visual stability problems that frustrate users and may negatively impact search rankings.
How do I find what’s causing layout shift?
Use Chrome DevTools Performance panel to identify layout shift sources. Record a page load, then look for “Layout Shift” entries in the timeline. Click each entry to see which DOM elements shifted. The Web Vitals extension also shows shift details in real-time.
Does CLS only measure above-the-fold content?
No, CLS measures all visible content shifts in the viewport. This includes shifts that happen as users scroll down the page. Lazy-loaded images, infinite scroll content, and dynamically inserted elements anywhere on the page can all contribute to CLS.
Do user-initiated actions count toward CLS?
No, layout shifts within 500ms of user input are excluded from CLS. If a user clicks a button and that causes content to shift, it doesn’t count toward CLS because the user expected a response. Only unexpected shifts affect your score.
Why is my CLS different in lab vs field data?
Lab tools only measure CLS during initial page load, while field data captures the entire page lifecycle. Real users scroll, interact, and stay on pages longer, experiencing shifts that lab tools miss. Always prioritize field data from CrUX or Search Console.
Technical SEO Services from Egochi
Egochi, America’s #1 digital marketing agency headquartered in New York City, provides expert technical SEO services including Core Web Vitals optimization.
CLS Audits: We analyze your site’s layout stability, identify shift sources, and prioritize fixes by impact. Our audits examine images, ads, fonts, embeds, and dynamic content that cause layout shifts.
Implementation Support: Our developers implement CLS improvements including image dimension attributes, ad slot sizing, font optimization, and CSS fixes. We work with your team or handle implementation directly.
Ongoing Monitoring: We set up Real User Monitoring to track CLS over time and alert you to regressions. New content, ads, or features can reintroduce CLS issues, and we help you maintain stable pages.
Proven Results: From our offices in NYC, Milwaukee, Madison, and Miami, we’ve helped clients achieve “good” Core Web Vitals scores and improve search rankings through technical optimization.
Need Help with Core Web Vitals?
Get a free technical SEO audit from Egochi. We’ll analyze your CLS and other performance metrics.
Get Free CLS AuditOr call (888) 644-7795






Comments are closed.