Core Web Vitals: Cumulative Layout Shift – What It Is and How to Improve It for SEO
In May 2020, Google announced that “core web vitals” would be incorporated into a ranking algorithm update called page experience, set to hit in 2021. Core web vitals is a set of core webpage functionalities that impact user experience. And we believe they will play a part in strategic SEO and impact how websites rank in Google.
At the time of writing, Google has defined three core web vitals:
- Largest contentful paint
- First input delay
- Cumulative layout shift
This is the last article in our series about Google’s upcoming Page Experience update. Here I’ll discuss cumulative layout shift, or CLS:
What Is Cumulative Layout Shift (CLS)?
CLS measures the formatting changes to a webpage after the initial rendering in a browser, usually by the dynamic insertion of content above what is already being shown.
It is generally annoying to be clicking on a link and have that link “move,” resulting in a click to an unexpected location. This kind of instability of content on a webpage creates a bad user experience.
Google discusses CLS here:
Cumulative Layout Shift (CLS) is an important, user-centric metric for measuring visual stability because it helps quantify how often users experience unexpected layout shifts—a low CLS helps ensure that the page is delightful.
Unexpected page layout shifts hurt the user experience. One example is when a button or link shifts on the webpage, causing a person to click something else. This can be really bad if it means they accidentally made a purchase, as you can see in this demo from Google:
Importantly, Google clarifies that not all layout shifts are considered bad:
A layout shift is only bad if the user isn’t expecting it. On the other hand, layout shifts that occur in response to user interactions (clicking a link, pressing a button, typing in a search box and similar) are generally fine, as long as the shift occurs close enough to the interaction that the relationship is clear to the user.
How Is Cumulative Layout Shift (CLS) Measured?
CLS is measured by the total of all individual layout shift scores for every unexpected layout shift that occurs during the entire lifespan of the page.
To calculate a layout shift score, Google multiplies the impact fraction and the distance fraction. I’ll break these down.
Impact fraction is how much viewport area an unstable element takes up between two frames.
In the example below, you can see that the element takes up 50% of the original viewport, but then is moved down by 25%. Between both frames, the element takes up 50% plus 25% of the viewport, causing the impact fraction to be 75%.
Example of layout shift between two frames, Google Developers
Distance fraction is the distance that an unstable element has moved. The example below shows that the element has moved 25% of the viewport height.
Example of distance shift in the viewport, Google Developers
So to sum up: CLS is measured by the layout shift score, which is calculated like so:
Impact fraction * distance fraction = layout shift score
Taking the examples above, the calculation would go like so: 0.75 * 0.25 = 0.1875. Google says a webpage should maintain a CLS of less than 0.1 across all pages on your site. This example would be over that goal, so it would score poorly.
Google totals all the scores for every unexpected layout shift that occurs during the entire lifespan of the page. So the more elements you have on your page that shift in the viewport, the worse your score will be.
Google’s CLS score target
How Does Cumulative Layout Shift (CLS) Impact SEO?
As with the other core web vitals, CLS helps ensure that the page experience is smooth for your visitors — on both mobile and desktop.
A good layout shift score can help ensure users don’t get frustrated with your webpage, don’t accidentally click and get taken to another page, and don’t mistakenly make a purchase. A good user experience helps you achieve all the outcomes we like to see in SEO: rankings, traffic, conversions and revenue.
According to Screaming Frog research, URLs in Position 1 of the search results were 10% more likely to pass the core web vitals assessment than URLs in Position 9. Of course, this relates to the existing pages — which may not comply with core web vitals yet — even before these factors apply to the ranking algorithms.
Looking at CLS, less than half (46%) of mobile URLs and less than half (47%) of desktop URLs had “good” CLS scores. The average CLS score was 0.29 on mobile and 0.25 on desktop. In other words, there is room for CLS improvement on most sites.
Screaming Frog segmented pass rates by position, and found a decline in the percentage of “good” URLs as you move down the positions on the search results page. The following example is mobile results, but they also graphed the data for desktop.
How Do I Improve My Cumulative Layout Shift (CLS) Score?
Google offers lab tools and field tools to help you measure, then optimize, your CLS score. For CLS, lab tools may not be as useful as the real data captured in the wild for your webpages.
Tools provided include:
- Chrome User Experience Report (field)
- PageSpeed Insights (field)
- Search Console (Core Web Vitals report) (field)
- Chrome DevTools (lab)
- Lighthouse (lab)
- WebPageTest (lab)
Common causes of layout shifts include:
- Images without dimensions
- Ads, video and other embedded objects or iframes without dimensions
- Dynamically injected content
- Late-loading CSS where styles are applied after other items have been loaded
- Web fonts causing flashes of invisible or unstyled text
- Elements on the page that wait for other items to be loaded over the network before appearing
Basic principles that will improve CLS include:
- Always use size attributes for images, videos and other embedded items or iframes. If an element is dynamically loaded, use CSS to style any container elements to the same size or aspect ratio before the content is loaded. Then, when the content is loaded into those container elements, the page will not shift.
- Never insert content dynamically above existing content.
- If using CSS to animate elements, prefer “transform” animations.
And check out this video about CLS from Google Chrome Developers on YouTube:
To understand more about the coming update, read our entire Page Experience series:
- What’s the Page Experience Update?
- How to Make a Mobile-Friendly Site
- Intrusive Interstitials & Why They’re Bad for SEO
- Safe Browsing to Protect Your Website, Visitors & Ranking
- HTTPS for Users and Ranking
- Core Web Vitals Overview
- Core Web Vitals: LCP (Largest Contentful Paint)
- Core Web Vitals: FID (First Input Delay)
- Core Web Vitals: CLS (Cumulative Layout Shift)
If you need expert SEO assistance, please contact us for a free consultation today.