SEO

What Is Cumulative Layout Shift and How Do You Fix It?

Find and fix Cumulative Layout Shift: the 0.1 score Google calls good, the causes to check in PageSpeed Insights and Chrome, and fixes for WordPress.

Published On:

Painted redwood forest with sunbeams and a card showing the Cumulative Layout Shift fix order
Table of contents

Cumulative Layout Shift (CLS) is a Google metric that scores how much the visible content of a web page moves without warning while someone uses the page.

I ran Lighthouse, Google's free page testing tool, on 2 pages of my own website, and the pages scored 0.02 and 0 against Google's good limit of 0.1. This guide covers what CLS is, good CLS scores, how to measure CLS, the common causes and the fixes, with WordPress steps.

What is Cumulative Layout Shift?

CLS is a score for unexpected movement on a web page, such as a button that drops down the screen when an ad appears above it. A layout shift is one such move: a visible element changes its position between 2 rendered frames (the pictures of the page a browser draws).

The Cumulative Layout Shift definition web.dev gives is "a measure of the largest burst of layout shift scores for every unexpected layout shift" during the life of a page.[1] The web.dev site holds Google's documentation for web developers.

A browser calculates the CLS of a page from 3 parts:

  • Impact fraction: The impact fraction is the share of the visible screen that the moving content covers, before and after the move combined.
  • Distance fraction: The distance fraction is how far the content moved, divided by the longer side of the visible screen.
  • Burst: A burst, also called a session window, is a group of shifts less than 1 second apart that lasts 5 seconds at most. The CLS of a page is the score of its largest burst.

The score of one shift is the impact fraction multiplied by the distance fraction. In web.dev's example, 0.75 multiplied by 0.25 gives a layout shift score of 0.1875.

The layout shift score formula: impact fraction 0.75 multiplied by distance fraction 0.25 gives a layout shift score of 0.1875

Some movement is expected and does not raise the CLS score:

  • Visitor actions: A layout shift within 500 milliseconds (half a second) of a click, tap or key press is not counted.
  • Transform animations: An element that moves with the CSS (Cascading Style Sheets, the code that styles a page) property "transform" does not cause layout shifts.
  • New or resized elements: An element that is added or changes size does not count if no other visible element moves.

Scrolling and hovering do not count as visitor actions for CLS. A layout shift caused by a lazy-loaded image (an image loaded when the visitor reaches it) still adds to the CLS score.

What is a good CLS score?

A good CLS score is 0.1 or less at the 75th percentile of page loads, checked separately for mobile and desktop. The 75th percentile means at least 75% of page visits scored that value or better.

Google sorts CLS scores into 3 ranges, and CLS has no unit because the score is not a time:

  • Good: A CLS score of 0.1 or less is good.
  • Needs improvement: A CLS score above 0.1 and up to 0.25 needs improvement.
  • Poor: A CLS score above 0.25 is poor.

How does CLS affect SEO?

CLS is one of Google's 3 Core Web Vitals (its measures of loading, response and visual stability), and Google states that "Core Web Vitals are used by our ranking systems".[2] Google also states that good Core Web Vitals results do not guarantee that a page ranks at the top.

Google adds that chasing a perfect score only for SEO (search engine optimization) may not be the best use of your time. A practical order is to fix pages above 0.25 first, then pages above 0.1, and to leave pages at 0.1 or less alone.

How do you measure CLS?

Measure CLS in 2 ways: field data, which comes from real visitors, and lab data, which comes from one controlled test. Field data tells you whether a page passes, and lab data helps you find the element that moved.

  • Search Console: The Core Web Vitals report in Google Search Console shows field data for groups of similar URLs (web addresses) over the last 28 days.[3]
  • PageSpeed Insights: PageSpeed Insights shows field data and a Lighthouse lab test for one page. New or low-traffic pages may show data for the whole website, or no field data.[4]
  • Chrome DevTools: The Performance panel in Chrome DevTools (Chrome's built-in developer tools) shows a live CLS number while you use the page.
  • Lighthouse: Lighthouse usually tests one page load, so its CLS can be lower than the CLS real visitors get.

Here are the steps to find a layout shift with PageSpeed Insights and Chrome DevTools:

  1. Open PageSpeed Insights, enter the page address and run the test.
  2. Compare the CLS under "Discover what your real users are experiencing" with the CLS under "Diagnose performance issues".
  3. Check whether the real-user section shows data for this URL or for the whole website (origin).
  4. Open the same page in Chrome, open DevTools and select the "Performance" panel.
  5. Record a page load, then look at the "Layout shifts" track. Each diamond is one shift, and a larger diamond is a larger shift.
  6. Click the largest diamond to see which elements moved, then look above those elements for the content that pushed them.

The gap between field CLS and lab CLS tells you when the layout shift happens:[5]

  • Field and lab are both high: The layout shift usually happens while the page loads, so record a page load in DevTools.
  • Field is high and lab is low: The layout shift often happens after loading, so scroll, hover and open menus while you watch the live CLS number.
  • Field is low and lab is high: Real visitors already pass, so check whether the test device or screen size matches your audience.

I do full-site SEO audits, and a page that lists many layout shifts can still pass. My homepage's Lighthouse report listed 9 layout shifts in 2 bursts, and the larger burst, from an animated chat mock-up, set the score of 0.02.

What are the common causes of CLS?

Common causes of a poor CLS are images without dimensions, late ads and embeds, injected banners, web fonts and some animations. Chrome's "Layout shift culprits" insight may offer a best guess at the cause on your page.[6]

  • Images and videos without dimensions: The browser cannot reserve space for an image with no known size, so text moves down when the image appears.
  • Ads, embeds and iframes: An iframe is a page shown inside another page, such as a YouTube player, and its space is not always reserved before the player loads.
  • Banners and forms added late: A cookie notice or signup bar inserted at the top pushes the whole page down.
  • Web fonts: Text is first laid out in a fallback font (a substitute font). A web font with different letter sizes moves the text when the web font loads.
  • Animations of position: An animation that changes the CSS "top" or "left" property causes layout shifts.
  • Slow responses to clicks: Content that moves the page more than 500 milliseconds after a click counts as an unexpected shift.

The element named in a Lighthouse report is often the element that was pushed. Look for the cause in the content that was added or resized above that element.

Which Cumulative Layout Shift fix should you use?

The most useful CLS fix is to reserve space for every element before the element loads. Fix the page template before single pages, because one template change repairs every page built from that template.

Here are the steps to fix CLS, for you or your developer:

  1. Add width and height attributes to every image and video. Modern browsers use both numbers to reserve space with the right shape.
  2. Set the CSS "height" property to "auto" on responsive images (images that resize with the screen), so the image keeps its shape.
  3. Give each ad slot and embed a minimum height with the CSS "min-height" property, or a shape with "aspect-ratio".
  4. Keep the reserved space when no ad is returned. Removing the space can cause as much CLS as adding content.
  5. Show cookie notices as a sticky footer or a modal (a box over the page), so the notice does not push content down.[7]
  6. Preload important web fonts and choose a fallback font of a similar size.
  7. Change animations from "top", "left", "width" or "height" to "transform".
  8. Reserve the space for slow content within 500 milliseconds of the click that requests the content.
  9. Run PageSpeed Insights again on one page from each template.

The image tag below is an example that reserves a 16:9 space before the file loads:

Verified
<img src="chart.webp" width="1280" height="720" alt="Monthly signups">

I checked the HTML (the code behind a page) of my AI SEO tips post, and all 17 image tags carry a width and a height. Lighthouse gave the post a CLS of 0 in one mobile lab run.

A site with many similar pages gains the most from a template fix. Search Console reports Core Web Vitals by URL group, and my programmatic SEO guide explains how one template builds many pages.

How do you fix CLS in WordPress?

Fix CLS in WordPress by giving images their dimensions first, then checking the theme, ad plugins, embeds and fonts. I have used WordPress, a website content system whose themes and plugins can each add content that moves the page.

WordPress has added missing width and height values to image tags since version 5.5, but only for images from the Media Library that carry the "wp-image" class.[8] An external image can therefore still lack dimensions.

Here are the steps to fix CLS on a WordPress site:

  1. Test one post, one page and the homepage in PageSpeed Insights, because each can use a different template.
  2. Open the "Layout shift culprits" insight and write down the element that moved.
  3. Add a missing image from the "Media Library" option of the Image block, and leave its height on "Auto" in most cases.
  4. Use a plugin setting such as "Add missing image dimensions" in the Media tab of WP Rocket for images on your own domain. WP Rocket skips externally hosted images by default.[9]
  5. Turn off sliders, popups and ad plugins one at a time on a staging site (a private copy), and retest after each change.
  6. Clear the cache (saved copies of pages) and test while logged out.

Free AI Product Marketing Playbook to advance your career

Where should you start with Cumulative Layout Shift?

Start with the mobile Core Web Vitals report in Search Console, because the report shows which groups of pages fail Cumulative Layout Shift for real visitors. Follow 3 first steps in Search Console and PageSpeed Insights:

  1. Open the mobile report and choose the CLS issue that affects the most URLs.
  2. Click an example URL and run a PageSpeed Insights test for that page.
  3. Fix the largest layout shift in the page template, then test one more page from the group.

I run technical, on-page and programmatic SEO across SaaS (software as a service) websites, so I would start with the template that affects the most pages. Real-user CLS data covers 28 days, so give a fix about 4 weeks before you judge the field score.

For tools that show technical problems while you browse a page, read my guide to the best SEO Chrome extensions.

Cumulative Layout Shift FAQs

How to fix Cumulative Layout Shift WordPress issues without code?

Add images from the WordPress Media Library, because WordPress can fill in missing width and height values for Media Library images. A plugin such as WP Rocket can add missing dimensions to more images on your own domain. Switch off popups, sliders and ad plugins one at a time on a staging site to find any other cause, then retest in PageSpeed Insights.

How can I improve Cumulative Layout Shift that only fails for real visitors?

Look for layout shifts that happen after the page loads. Open Chrome DevTools, go to the Performance panel, then scroll, hover and open menus while the live CLS (Cumulative Layout Shift) number is visible. Lazy-loaded images, late ads and slow menus are possible reasons a page passes a lab test but fails in real-user data.

Does Cumulative Layout Shift SEO impact matter for rankings?

Yes, Cumulative Layout Shift matters for SEO (search engine optimization) because CLS is a Core Web Vital, and Google's ranking systems use Core Web Vitals. Google also says good Core Web Vitals do not guarantee top rankings, so fix CLS for your visitors first and keep improving the relevance of your content.

Is a CLS score of 0 necessary?

No, a CLS score of 0 is not necessary. Google rates a CLS of 0.1 or less as good, measured at the 75th percentile of page loads. Google also says trying to get a perfect score only for SEO may not be the best use of your time, so stop once real visitors are safely below 0.1.

Why is my CLS good in Lighthouse but poor in Search Console?

Lighthouse usually tests one page load in a controlled setting, while Search Console reports real visits over 28 days. Real visitors scroll, wait for ads and open menus, so their visits can include layout shifts Lighthouse never saw. Search Console also groups similar pages, so a different page in the group can cause the poor score.

Do layout shifts after a click count toward CLS?

No, layout shifts within 500 milliseconds of a click, tap or key press do not count toward CLS, because the visitor expects the page to respond. Layout shifts caused by scrolling or hovering do count, and so does a menu or form that moves the page more than 500 milliseconds after the click.

View all