Glossary

Cumulative Layout Shift (CLS)

What is Cumulative Layout Shift (CLS)?

Cumulative Layout Shift (CLS) measures how much the content of a page moves unexpectedly while it is open. A layout shift happens when a visible element changes its position from one rendered frame to the next, such as a paragraph pushed down by something that loads above it. CLS is the visual stability metric among the Core Web Vitals.

How it works

Each layout shift gets a score:

layout shift score = impact fraction * distance fraction

The impact fraction is the share of the viewport that the moving elements cover, before and after the move together. The distance fraction is the furthest any of them moved, divided by the viewport's width or height, whichever is greater. In web.dev's example, an element covering half the viewport moves down by a quarter of the viewport height: an impact fraction of 0.75 and a distance fraction of 0.25 give a score of 0.1875.

Shifts that follow each other with less than 1 second in between are grouped into a session window of at most 5 seconds. CLS is the score of the worst window over the whole life of the page. An element that is added or grows does not count by itself; only elements that change their start position do. Shifts within 500 milliseconds of a tap, click or key press are left out, because the visitor expects them.

web.dev counts 0.1 or less as good and more than 0.25 as poor, measured at the 75th percentile of page loads, segmented across mobile and desktop devices.

Why it matters

Content that moves while someone reads makes them lose their place. A link or button that moves just as they tap it sends them somewhere they did not mean to go.

What can go wrong

  • Content that arrives late, such as an ad or the answer to a network request, is inserted without space kept for it and pushes everything below it down.
  • An animation changes top or height instead of using transform, so the layout shifts on every frame.
  • Scrolling does not count as recent input, so content that moves while the visitor scrolls counts against the page.
  • A lab run only measures shifts during page load, so the CLS it reports can be lower than what visitors get.

Check it

Ranetrace's Lighthouse monitoring records CLS from each scheduled Lighthouse audit, run with the mobile form factor. A lab run sees only the shifts during load, so for what visitors meet after that, use the field data in PageSpeed Insights, which comes from the Chrome User Experience Report, or the web-vitals JavaScript library in your own pages.

Start monitoring today

Websites go down and code throws errors. Ranetrace tells you when it happens to yours, why it matters and what to do next.

Start your 30-day free trial From $9 a month. No credit card required.