Go straight to the answers
Vega SEO Talks

How does the CLS scoring algorithm handle multiple small layout shifts versus a single large shift within the same session window?

Answered 3-minute answer rooted in 1 page

The same way: within a session window, shift scores are simply added. A burst of ten shifts scoring 0.01 each gives the window a score of 0.1, exactly like one shift scoring 0.1. The difference between “many small” and “one large” only matters when the shifts fall into different windows. CLS reports the largest session window, not the total for the page, so small shifts spread out over time can each start a new, small window, while the same shifts clustered together add up in one.

How a single shift is scored

web.dev’s CLS article defines each shift’s score as:

layout shift score = impact fraction * distance fraction

  • Impact fraction: the share of the viewport covered by the unstable elements across the two frames, counting both where they were and where they moved to.
  • Distance fraction: the largest distance any unstable element moved, divided by the viewport’s largest dimension.

The article’s own example: an element covering half the viewport moves down by 25% of the viewport height. The union of its old and new positions covers 75% of the viewport, so the impact fraction is 0.75. The distance fraction is 0.25. The shift scores 0.75 × 0.25 = 0.1875.

How shifts are grouped

A session window is “one or more individual layout shifts” that “occur in rapid succession with less than 1-second in between each shift and a maximum of 5 seconds for the total window duration”. CLS is the score of “the session window with the maximum cumulative score”.

Two consequences:

Pattern What happens
Ten shifts of 0.01, each less than 1 second apart, within 5 seconds One window; score 0.1
One shift of 0.1 One window; score 0.1
Ten shifts of 0.01, each more than 1 second apart Ten windows of 0.01; CLS 0.01
A window would run past 5 seconds It closes at 5 seconds and the next shift starts a new window

Google’s threshold for good CLS is 0.1 or less at the 75th percentile, so the first two rows are both at the edge of “good”, and the third is comfortably inside it.

What does not count

web.dev lists two exclusions that change the arithmetic in practice:

  • Shifts right after input. Shifts “that occur within 500 milliseconds of user input” are flagged with hadRecentInput and excluded. This covers taps, clicks and key presses.
  • Not every movement is a shift. A layout shift is recorded when an element “that is visible within the viewport changes its start position”. Elements outside the viewport, and new elements added without moving existing ones, do not produce a score.

Scrolling is not “recent input”, so shifts that happen while a visitor scrolls still count.

What this means for fixes

  1. Fix the biggest window first. Since CLS reports one window, removing small shifts elsewhere does not help if the worst window stays.
  2. Look for clusters. A chain of small shifts during load, such as images, then an ad slot, then a font swap, can add up in one window to more than any single cause suggests.
  3. Do not treat small shifts as harmless. Several of them within a second of each other score as much as one large one.
  4. Use attribution to see the window. CLS attribution from real visits shows which elements shifted and when, which is the information needed to see whether shifts are clustered or spread out.

Within one session window, many small shifts and one large shift of the same total score the same, and the difference appears only when shifts fall into separate windows, because CLS reports the single worst window rather than the page total.

Answers that share these roots

  1. Why do web font loading strategies that use font-display swap sometimes create CLS spikes that exceed the good threshold even with preloading? shares 1 page

Replies to this answer

Leave a Reply

Your email address will not be published. Required fields are marked *