SpeeJax Header
SpeeJax logo SpeeJax

Cumulative Layout Shift: Causes, Examples and Prevention

Cumulative Layout Shift (CLS) is a Google Core Web Vitals metric that measures the visual stability of a webpage. It identifies unexpected movements of visible content while a page loads or while someone interacts with it. For example, an image might suddenly appear and push an article heading downward, or an advertisement might load above a button and move it just as someone is about to click.

These movements can make websites frustrating to use, cause accidental clicks, and interrupt reading. A good CLS score is 0.1 or lower, while a score above 0.25 is considered poor.

Understanding what causes layout shifts, how the metric works, and how to prevent unnecessary movement helps developers improve website usability, performance, and Core Web Vitals.

What Is Cumulative Layout Shift (CLS)?

Cumulative Layout Shift measures unexpected changes in the position of visible webpage elements. It evaluates how much content moves and how far the affected elements travel within the viewport.

A webpage experiences a layout shift when an element that was already visible changes its position between two rendered frames. This often happens because an image, advertisement, web font, banner, or other resource loads after the surrounding content has already appeared.

Consider a visitor reading an article. The heading and introductory paragraph initially appear at the top of the screen. A few seconds later, an advertisement loads above them and pushes the text downward. The visitor must find their reading position again. This is an example of poor visual stability.

CLS is one of the three Core Web Vitals:

  • Largest Contentful Paint (LCP): Measures loading performance.
  • Interaction to Next Paint (INP): Measures responsiveness to user interactions.
  • Cumulative Layout Shift (CLS): Measures visual stability.

Unlike LCP and INP, CLS is a unitless score rather than a measurement in seconds or milliseconds.

What Is a Good Cumulative Layout Shift Score?

Google recommends a CLS score of 0.1 or lower for at least 75% of page visits. Scores are classified into three performance categories.

CLS scorePerformanceInterpretation
0 to 0.1GoodThe page has relatively stable content.
Above 0.1 to 0.25Needs improvementUnexpected movement may affect the experience.
Above 0.25PoorThe page experiences significant visual instability.

The target should be to keep CLS at or below 0.1, not simply to avoid the poor category.

These thresholds should be evaluated using the 75th percentile of real user page visits, with mobile and desktop results considered separately. This helps website owners understand the experience of the majority of visitors rather than relying on a single test performed on one device.

How Is Cumulative Layout Shift Calculated?

CLS uses two measurements to calculate the score of an individual layout shift:

  1. Impact fraction: Measures how much of the viewport is affected by unstable elements.
  2. Distance fraction: Measures how far the affected elements move relative to the viewport.

The individual layout shift score is calculated using:

Layout Shift Score = Impact Fraction × Distance Fraction

Understanding impact fraction

Impact fraction measures the portion of the viewport occupied by the affected elements, considering their visible areas before and after the movement.

For example, imagine an element that occupies approximately 75% of the viewport’s area when its previous and new positions are considered together. Its impact fraction would be 0.75.

Understanding distance fraction

Distance fraction measures the greatest distance an unstable element moves, divided by the viewport’s largest dimension.

For example, if the affected element moves by 25% of the viewport’s largest dimension, the distance fraction is 0.25.

A practical CLS calculation example

Suppose an advertisement loads above an article introduction and pushes the visible content downward.

Assume the following values:

  • Impact fraction: 0.75
  • Distance fraction: 0.25

The calculation becomes:

0.75 × 0.25 = 0.1875

The individual layout shift score is 0.1875.

This is an individual shift score, not necessarily the final CLS score for the page. CLS uses the largest session window of unexpected layout shifts during the page’s lifecycle.

What is a CLS session window?

A session window is a group of layout shifts that happen close together. It begins with a layout shift and can include subsequent shifts when less than one second separates them. A session window can last up to five seconds in total.

CLS is the highest cumulative score among these session windows.

For example, imagine a page experiences several shifts while loading and another group of shifts later when advertisements appear. The browser evaluates these groups separately and uses the session window with the highest cumulative score.

This is different from the older CLS calculation, which summed all unexpected layout shift scores across the entire page lifecycle.

Common Causes of Cumulative Layout Shift

Layout shifts usually occur when content is displayed or resized without enough space being reserved for it. The following causes are particularly common on websites.

Images and videos without defined dimensions

Images are a frequent source of layout instability. When a browser receives an image without its dimensions or another way to determine its aspect ratio, it may initially allocate insufficient space for it.

Once the image loads, the browser adjusts the layout to accommodate its actual dimensions. Text and other elements below it may move.

For example, an article page might display its title and opening paragraphs before downloading the featured image. If the image’s dimensions are unknown, it can push the text downward after loading.

Prevention: Define image width and height attributes so the browser can calculate the image’s aspect ratio before downloading it.

<img

  src=”featured-image.jpg”

  alt=”Featured article image”

  width=”1200″

  height=”675″

>

For responsive images, CSS can still control the displayed size:

img {

  max-width: 100%;

  height: auto;

}

The width and height attributes provide the intrinsic aspect ratio, while CSS allows the image to scale with its container.

The same principle applies to video elements. Reserve their display area before the video loads.

Advertisements that load dynamically

Advertisements can create CLS when an ad slot initially has no reserved space and an advertisement appears later.

This is particularly common on publisher websites that use advertising networks. An ad might load after the article content has already appeared, pushing headings, paragraphs, and other elements downward.

Ad networks can also deliver different creative sizes, making the amount of space required unpredictable.

Prevention: Reserve space for advertising containers before the advertisements load. Use an appropriate minimum height or aspect ratio based on the ad formats your website serves.

For example:

.ad-slot {

  min-height: 250px;

}

This is an illustrative value, not a universal advertisement size. Choose dimensions based on the actual advertising inventory and adapt them for different screen sizes where necessary.

Iframes and embedded content

Third-party embeds such as YouTube videos, social media posts, maps, and external widgets may load after the initial webpage content.

If the browser does not know how much space to allocate, the embedded content can push surrounding elements out of position.

For example, a webpage might initially display a small video placeholder. Once the video player loads, its full height becomes available and moves the content below it.

Prevention: Set dimensions on iframe elements or reserve space through a responsive container.

<div class=”video-container”>

  <iframe

    src=”https://www.youtube-nocookie.com/embed/example”

    title=”Embedded video”

    width=”560″

    height=”315″

    loading=”lazy”

  ></iframe>

</div>

.video-container {

  aspect-ratio: 16 / 9;

}

.video-container iframe {

  width: 100%;

  height: 100%;

  border: 0;

}

The reserved aspect ratio helps the browser maintain the required space while the embedded resource loads.

Web fonts loading after page content

Custom fonts can change the size, width, and spacing of text. When a browser initially displays a fallback font and later replaces it with a downloaded web font, text may occupy a different amount of space.

This can change line breaks, paragraph heights, heading sizes, and the positions of surrounding elements.

For example, a heading might initially fit on one line using a fallback font but wrap onto two lines after the preferred font loads. Content below it then moves downward.

Prevention: Use a fallback font with metrics similar to the primary web font. Consider font-display settings such as optional where appropriate, and use font metric adjustment properties such as size-adjust, ascent-override, and descent-override when suitable.

Important fonts can also be loaded earlier when they are needed for the initial page rendering. However, preloading should be limited to genuinely critical fonts.

Dynamically inserted content

Websites frequently use JavaScript to insert additional elements after the initial page has loaded. These may include:

  • Cookie consent banners.
  • Promotional messages.
  • Newsletter subscription forms.
  • Product recommendations.
  • Notification bars.
  • Recently viewed products.
  • Automatically updated content.

If these elements are inserted into the normal document flow without reserving space, existing content may move.

For example, a cookie notice that appears at the top of a page after a short delay can push the navigation and main content downward.

Prevention: Reserve space for content that must appear within the page layout. Alternatively, use an appropriate overlay when it does not interfere with important controls or accessibility.

When users request additional content, such as more products or search results, provide a predictable loading area rather than unexpectedly moving existing content.

CSS animations and transitions

Some animations change properties that affect the document’s layout. Animating properties such as top and left can move elements and cause layout-related movement.

Animations that repeatedly change the layout can create visual instability, particularly when other content is positioned around the animated element.

Prevention: Prefer CSS transform and opacity for animations where appropriate.

For example:

.card {

  transition: transform 0.3s ease;

}

.card:hover {

  transform: translateY(-5px);

}

Using transforms can animate the visual position of an element without changing the surrounding document layout in the same way as properties such as top and left.

Real-World Examples of Cumulative Layout Shift

Understanding common scenarios makes it easier to identify CLS problems during website development.

Website situationWhat happensWhy it affects CLS
Blog featured imageThe image appears after the heading and paragraphs.Content below the image moves when space is allocated.
E-commerce product pageA promotional banner loads above product details.Product information moves down unexpectedly.
News websiteAn advertisement appears between the navigation and article.Visible article content is pushed downward.
Video landing pageAn embedded player expands after loading.Content below the player changes position.
Website using custom fontsThe font changes after the page initially renders.Text wrapping and surrounding element positions change.
Single-page applicationA new page view replaces existing content after a delay.A late transition can move visible elements unexpectedly.

These examples show why a website can appear stable during development but still have a poor CLS score for real visitors. Network speeds, cached resources, advertising responses, browser differences, and personalized content can change when elements appear.

How to Prevent Cumulative Layout Shift

Reducing CLS requires controlling how webpage elements are positioned before resources and dynamic content become available.

Reserve space for media elements

Define the dimensions of images, videos, and other media before they load. Use HTML width and height attributes or CSS aspect ratios to give the browser enough information to calculate the required space.

For responsive images, ensure the declared dimensions represent the correct aspect ratio for the selected image.

Create placeholders for advertisements and embeds

Do not allow advertisements or external widgets to determine the layout only after they load.

Create containers that reserve the expected space from the beginning. For dynamic ad sizes, use appropriate minimum heights and responsive rules based on the formats your website supports.

Control dynamically loaded content

Avoid inserting new content above existing visible elements without accounting for the resulting movement.

Use reserved containers, skeleton interfaces, or user-initiated loading controls where appropriate. When content takes time to retrieve, display a stable loading area rather than allowing the page to reorganize unexpectedly.

Optimize web font loading

Choose fallback fonts that are visually and metrically similar to the intended font.

Load important fonts efficiently and use suitable font-display settings. Where necessary, adjust fallback font metrics to reduce differences in text dimensions.

Use layout-friendly animations

Avoid animating layout-affecting properties when a transform or opacity animation can achieve the same visual result.

This is particularly important for menus, cards, navigation elements, banners, and other components that move while users interact with them.

Test pages on different devices and conditions

A page that works well on a fast desktop connection may behave differently on a mobile device with slower network access.

Test important templates across mobile and desktop screen sizes. Include situations involving slower connections, fresh browser caches, advertisements, embedded widgets, and dynamically loaded content.

Testing only a fully cached page can hide problems that visitors experience during their first visit.

How to Measure and Check Cumulative Layout Shift

Website owners can identify CLS problems using both real-user data and controlled performance tests.

Google PageSpeed Insights

PageSpeed Insights provides performance information for individual URLs.

Enter a webpage address and review the Core Web Vitals information. When sufficient real-user data is available, the report includes field data from the Chrome User Experience Report. It also provides lab diagnostics through Lighthouse.

Comparing these results helps identify whether the problem occurs during the initial load or later in the visitor’s experience.

Google Search Console

The Core Web Vitals report in Google Search Console shows how pages perform using real-world usage data.

It groups similar URLs and reports their performance status for mobile and desktop. Website owners can review groups classified as Good, Need improvement, or Poor and investigate examples within affected groups.

This is useful when a problem affects a particular page template, such as product pages, blog posts, or category pages.

Chrome DevTools

Chrome DevTools provides detailed information about layout shifts during a performance recording.

A practical testing process is:

  1. Open the webpage in Google Chrome.
  2. Open Developer Tools using the browser’s Inspect option.
  3. Select the Performance panel.
  4. Start a recording and reload the page.
  5. Stop the recording after the relevant content has loaded.
  6. Examine the Layout Shifts track.
  7. Select individual shift events to inspect affected elements and their scores.

The Performance panel can help identify when a shift occurred and which visible elements moved. Start with the largest session window because it contributes the most to the page’s CLS score.

Real User Monitoring

Real User Monitoring (RUM) collects performance information from actual website visits.

Unlike a single laboratory test, field monitoring can reveal problems that depend on users’ devices, network conditions, browser behavior, location, scrolling, and interactions.

Developers can use the web-vitals JavaScript library or another suitable monitoring solution to collect Core Web Vitals measurements.

Combining real-user monitoring with laboratory testing provides a more complete understanding of website performance.

Lab Data vs. Field Data: Why CLS Scores Can Differ

A website may receive a good CLS score in a laboratory test but still perform poorly for actual visitors.

This happens because lab tests and field measurements observe different conditions.

Lab data comes from controlled testing environments with predefined device and network conditions. Tools such as Lighthouse generally evaluate a simulated page load.

Field data comes from real users visiting the website. It reflects a wider range of devices, network speeds, browsers, page interactions, and loading conditions.

For example, a basic Lighthouse test may not capture a layout shift caused by an advertisement that appears several seconds after the initial page load. It may also miss shifts caused by images that load when a visitor scrolls farther down the page.

Field measurements can capture these experiences across the page lifecycle.

Therefore, developers should not rely on one Lighthouse score alone. Use laboratory tests to reproduce and investigate problems, then use field data to understand whether the improvements are benefiting actual visitors.

Does Cumulative Layout Shift Affect SEO?

CLS is part of Google’s Core Web Vitals, which are used to evaluate aspects of real-world page experience.

A good CLS score indicates that a webpage provides a more visually stable experience. This can help visitors read content, use navigation, complete forms, and interact with buttons without unexpected movement.

Google recommends achieving good Core Web Vitals as part of providing a good page experience. These metrics also align with what its core ranking systems seek to reward.

However, a good CLS score does not guarantee higher search rankings. Core Web Vitals are only one aspect of Google’s broader evaluation of page experience and search quality.

Website owners should therefore improve CLS for both usability and technical performance rather than treating it as a shortcut to better rankings.

Common Cumulative Layout Shift Mistakes to Avoid

Several development practices can make visual instability harder to detect or prevent.

Testing only the initial page load: Layout shifts may happen after the page loads, particularly when advertisements, widgets, and lazy-loaded images appear. Test the full page experience.

Ignoring mobile devices: A layout that works on a wide desktop screen may behave differently on a narrow mobile viewport. Review both device categories.

Using images without dimensions: Responsive CSS alone does not always reserve space before an image downloads. Provide width and height attributes or an appropriate aspect ratio.

Allowing advertisements to resize freely: Ad slots that start with zero height can push content when the advertisement appears. Reserve suitable space in advance.

Using poorly matched fallback fonts: A significant difference between the fallback and preferred font can change text wrapping and move nearby content.

Fixing only the elements that moved: The visible elements identified in a performance report may be affected by another element inserted above them. Investigate the underlying cause rather than simply adjusting the moved content.

Relying entirely on laboratory scores: A successful test does not prove that every visitor experiences a stable page. Compare controlled test results with field data.

Frequently Asked Questions About Cumulative Layout Shift

What is a good CLS score?

A good CLS score is 0.1 or lower. Scores above 0.1 and up to 0.25 need improvement, while scores above 0.25 are considered poor.

What causes a high CLS score?

Common causes include images without dimensions, advertisements that load dynamically, iframes without reserved space, web font changes, and JavaScript that inserts new content into the page without accounting for existing elements.

How can I reduce CLS on my website?

Set dimensions for images and videos, reserve space for advertisements and embeds, use suitable font fallbacks, control dynamically inserted content, and prefer transform-based animations where appropriate. Test both desktop and mobile experiences.

Does lazy loading increase CLS?

Lazy loading does not automatically cause CLS. The problem occurs when a lazy-loaded image, video, or other resource appears without sufficient space being reserved for it. Defining dimensions or an aspect ratio helps prevent this problem.

Does CLS affect Google rankings?

CLS is a Core Web Vitals metric and part of Google’s page experience guidance. However, achieving a good CLS score does not guarantee a ranking improvement because Google’s ranking systems consider many factors.

Why is my Lighthouse CLS score different from Google Search Console?

Lighthouse measures performance under controlled test conditions, generally focusing on the initial page load. Google Search Console uses real-user field data from the Chrome User Experience Report. Differences can arise from mobile devices, slow connections, advertisements, scrolling, and layout shifts that happen after the initial load.

Conclusion

Cumulative Layout Shift measures unexpected movement of visible webpage content and helps website owners understand whether their pages provide a visually stable experience. Common causes include images without dimensions, dynamic advertisements, embedded content, changing web fonts, and late-loaded interface elements.

Preventing CLS starts with reserving space before content appears. Developers should define media dimensions, create stable ad and embed containers, control dynamic content, optimize font loading, and avoid unnecessary layout-affecting animations.

Aiming for a CLS score of 0.1 or lower, monitoring real-user performance, and testing different devices can help create a more predictable and accessible website experience.

More Guides

Cloud Hosting Providers Compared for Growing Websites

Cloudflare APO and WordPress Caching: Understanding the Differences

Cloudflare vs Bunny CDN: Features, Pricing and Performance

Common WordPress Optimization Mistakes That Slow Down Websites

Core Web Vitals Explained: Improving Website Performance in 2026

CSS Optimization Techniques for Faster Frontend Experiences

Cumulative Layout Shift: Causes, Examples and Prevention

Custom Website Development vs Template-Based Websites

Ecommerce Website Performance: Challenges and Optimization Priorities

Error Tracking Software and Its Importance in Web Applications

Essential Software for Freelance Web Developers

FlyingPress vs WP Rocket vs LiteSpeed Cache: A Feature Comparison