🛍 [BLACK FRIDAY] DISCOUNT! + 2x Benefits + $15k Worth of Offers for FREE

APPRENDRE ENCORE PLUS!

What is Cumulative Layout Shift?

The cumulative layout shift (CLS) records the largest unexpected layout shift on a webpage. It is the Éléments essentiels du Web metric Google uses to measure the visual stability of a webpage.

A layout shift occurs when an element (text, images, videos, widgets, or ads) changes its position or size. This shift causes other elements on the webpage to move to new locations and typically results in discomfort for the visitor consuming the content.

Sometimes, the visitor may see the content they are consuming being moved lower down the page. In certain cases, it may even cause them to click on links and buttons they never intended to click. So, Google introduced the cumulative layout shift to measure the layout shifts on a webpage.

The cumulative largest shift measures the layout shifts on a webpage and then reports the largest one as the cumulative layout shift.

What is a Good Cumulative Layout Shift?

A good cumulative layout shift is 0.1 or below. Google classifies your cumulative layout shift into three categories:

  • Good – 0.1 or less
  • Needs improvement – Above 0.1 and 0.25
  • Poor – More than 0.25

Importance of the Cumulative Layout Shift

Elements on a webpage do not all load at the same pace. Some load earlier than others. This means that elements on the webpage tend to shift around when they load. For example, let us imagine a webpage containing a block of text followed by an image and another block of text.

Sample of a webpage containing an image and two blocks of texts

The site may be configured to load the text first. So, the text gets loaded once the visitor arrives on the page, while the image has yet to load and has a small placeholder in its place instead.

Because the image is yet to load, the two blocks of text that would have been separated by the image are closer to themselves. A third block of text that should be lower down the page and outside the viewport is also visible.

Sample of a webpage containing three blocks of text and no image

However, the lower blocks of text are pushed further down the page when the image loads. The third block of text has even been pushed out of the viewport, and the visitor has to scroll down the page to view it.

Sample of a fully loaded webpage

From the above illustration, we can say that the image caused a layout shift that affected the other content on the webpage. This would hurt the user experience for the visitor and may even cause more severe issues, particularly when visitors click a button they never intended to click.

This makes the cumulative layout shift score a helpful metric for measuring the visual stability of a webpage. The cumulative layout shift score is one of the three metrics Google uses to calculate the Core Web Vitals of a webpage. The other two are:

The Core Web Vitals is not a ranking factor. Instead, it is one of the signals and metrics Google uses to assess the page experience of a webpage. Page experience is a ranking factor.

What is Not Considered a Layout Shift

Google is specific about the events that are considered a layout shift. Specifically, certain events are not considered a layout shift, even when they appear to be one. So, not all layout shifts are considered when calculating the cumulative layout shift score of a webpage.

1 Layout Shifts That Do Not Affect Other Elements

UN layout shift only occurs when a change in the position or size of an element causes other elements to change their positions on the webpage. If other elements do not move from their initial position when an element changes its position or size, it is not considered a layout shift and does not affect the cumulative layout shift score.

2 Layout Shifts That Occur Within 500 Milliseconds

Layout shifts that occur within 500 milliseconds of an interaction are not considered for the cumulative layout shift score. These interactions have the hadrecentinput flag set as the time between the interaction and layout shift is small enough to be insignificant.

3 Layouts Shifts That Are Expected

Cumulative layout shift only records unexpected layout shifts. If the visitor expects the layout shift, it will not be considered for the cumulative layout shift score. For example, visitors may experience layout shifts when they click a button or search bar. Such layout shifts are fine as long as they occur quickly enough that the user knows they occurred due to the interaction.

How to Measure the Cumulative Layout Shift

You can view the cumulative layout shift of your URLs using the Web Vitals extension. Using a Chromium-based browser like Chrome or Brave, head to the Web Vitals extension et cliquez Add to Chrome. (The exact wording may differ depending on the browser.) 

Head to the Chrome Web Store and download the Web Vitals extension

Once done, head to the webpage you are assessing and click the Web Vitals icon. (The shape and color of the icon may differ depending on the Core Web Vitals metric of the webpage.)

Sample of the Web Vitals icon

The cumulative layout shift of the page will be displayed, as shown below.

Sample of the cumulative layout shift of a webpage

🇫🇷 Français