How the Layout Instability API decides that a shift is unexpected, how session windows turn entries into one CLS value, and which real instability the score never sees.
Contents · 10 sections
Picture a product page that scores a CLS of 0.02 in the field while its support inbox fills with people who tapped the wrong button because the page jumped, and a news site next door at 0.3 that nobody complains about. Both numbers can be correct. They're answers to a narrower question than "is this page visually stable?", and the gap between the two questions is where most CLS arguments start.
The quick answer is that CLS "measures how much stuff moves". That isn't what it measures. It measures a product of two fractions, computed only for nodes that pass five separate tests, only for shifts that don't follow a discrete input within 500 ms, grouped into windows that no specification defines, and reported by one browser engine. Each of those clauses excludes something a user can see, and a few of them include things a user wouldn't call a problem.
This piece works through the Layout Instability API one algorithm at a time, then follows Google's documentation from the entries to the single number CrUX reports. It builds on the first part of this series (PRF-01) for what "passes Core Web Vitals" means at p75. Where I could, I ran the behavior in Chrome rather than paraphrasing it, and I say exactly how. Every status fact was checked on 18 October 2026.
CLS is a Chromium-only metric built on an incubation draft
Start with what kind of document this is, because it shapes everything after. The Layout Instability API is a Draft Community Group Report dated 17 December 2025, published by the Web Platform Incubator Community Group. Its status section says it "is not a W3C Standard nor is it on the W3C Standards Track". There was once a plan to change that: a call for consensus to adopt it into the Web Performance WG as a Working Draft has been open since August 2020. The other two Core Web Vitals rest on W3C Working Drafts, Largest Contentful Paint and Event Timing; CLS doesn't.
Implementation is narrower still. As of today, webstatus.dev lists layout instability performance entries with Baseline status "limited", implemented in Chrome, Chrome for Android and Edge 84 and nowhere else. Its Web Platform Tests scores for the stable channels of Firefox and Safari are 0. The CrUX and RUM comparison guide states the consequence plainly: CLS is only available in Chromium-based browsers. If your RUM tool shows CLS for Safari users, it's computing something else, and you should find out what.
There's a small disagreement about when Chrome shipped it. MDN's compat data for LayoutShift dates the interface, value, hadRecentInput and lastInputTime to Chrome 77, but sources to Chrome 84. The LayoutShiftAttribution interface is also Chrome 84. The web-features definition that webstatus.dev reads bundles all of those keys into one feature. My reading is that webstatus.dev's "84" is the version in which the last piece of the bundle arrived, and BCD's "77" is when the entry type first appeared. Both are right about different things. In this piece I use BCD's per-key versions, because they're the more specific claim, and Chromium's own CLS changelog agrees that the metric was exposed through the API in Chrome 77 and promoted to stable in Chrome 79.
Other engines have been asked. Mozilla's standards position on the API (#374) carries the label "position: positive" and has been closed since 2020. The thread is worth reading for what it worried about: one commenter asked whether parallax effects and fast animations would count as instability, another raised complexity, performance cost and the privacy of exposing the data to pages at all. The Gecko implementation bug filed in July 2020 is still status NEW at priority P3. When a November 2025 request asked Mozilla for a position on reporting attribution in CSS pixels, a Mozilla engineer replied that Firefox doesn't implement the API, and the issue was closed and labelled "invalid" as too small a change for the positions dashboard. The matching WebKit request (#588) is still open; its only substantive comment, from Chrome's Michal Mocny in April 2026, says WebKit doesn't implement layout instability either and suggests closing it. I couldn't find a WebKit position on the core API at all.
So when this piece says "the spec says", it means a Google-edited incubation draft, and when it says "browsers do", it means Chromium. That isn't a reason to ignore CLS. It's the reason the rest of this piece separates the two so carefully.
A node is unstable only if it moved in every frame of reference that matters
The API doesn't watch elements move. Once per rendering update it compares each node's position now with its position at the previous report, and asks whether the node is unstable. The processing model hooks this into the HTML event loop's update-the-rendering steps, right after paint timing is marked, so "frame" here means one rendering opportunity, not one CSS animation tick or one vsync.
Position is measured at a single point. The basic concepts section defines a node's starting point as the offset to the flow-relative starting corner of its first box fragment (top-left, for horizontal left-to-right text), or of the first line box for a text node. Width and height don't enter into it. An element that grows taller without its top-left corner moving isn't unstable, although the elements it pushes down are. The web.dev CLS article makes the same point: adding an element or resizing one doesn't count as a shift unless it moves other visible elements' start positions.
Movement also has to be large enough. A point "differs significantly" from another if they differ by at least the user agent's number of pixels to significance in either direction, and a note in the spec says Chrome defines that number as 3. In Chrome, a node that moves less than 3 px both horizontally and vertically never makes it into an entry.
The five tests
The unstable nodes section defines an unstable-candidate as a node that passes all of these:
- It's an element that generates a box, or a text node.
- Its computed
visibilityisvisible, both now and in the previous frame. - Its computed
opacity, and that of every ancestor, isn't 0, both now and in the previous frame. - It has shifted in the coordinate space of the viewport and in the coordinate space of the initial containing block.
- No scroll container in its containing block chain explains the movement: if an ancestor with a scrollable overflow region isn't itself an unstable-candidate, and the node hasn't moved relative to that region, it's not a candidate.
And "shifted" itself is a double test. A node has shifted only if its starting point moved significantly and its transform-indifferent starting point moved significantly. The transform-indifferent point is computed as though every transform were the identity matrix. A spec note explains the purpose: a node shouldn't be made unstable solely because of a transform change. So an element moved by changing transform alone fails the second half, and an element whose layout moved but whose transform cancels the move fails the first half. Chrome's changelog records adding the counter-transform case, considering transform changes that counter a layout shift, in Chrome 90.
The double coordinate-space test in step 4 is what makes scrolling free. When the document scrolls, everything moves relative to the viewport but nothing moves relative to the initial containing block, so nothing fails both. Step 5 extends the same idea to nested scrollers: content scrolling inside an overflow: auto panel moves relative to the viewport and the ICB, but not relative to the panel.
Carousels get their own exemption
One more exclusion turns a candidate back into a stable node. An inline clip crosser is a candidate whose current or previous visual representation is empty, and which would stop being a candidate if only movement in the block direction counted. In plain terms: an element that slides sideways out of a clipping container, or into it, doesn't count, as long as it doesn't also move vertically (in horizontal writing modes). The spec's note names the use case directly: it makes certain "carousel" controls easier to build. Chrome's changelog lists the matching change, ignoring inline-direction shifts into or out of view, under Chrome 90. The unstable node set is every candidate that isn't a clip crosser, and in the very first frame it's always empty, because no previous starting point exists.
Chrome adds exclusions the spec doesn't list. Its changelog records that since Chrome 90 it ignores text with an unrenderable font or only whitespace, and blocks with no decorations or children. It ignores a shift in the same frame that a visibility: hidden element becomes visible (the changelog files this under Chrome 88, though its text says "before Chrome 89"), and since Chrome 89 it ignores shifts under opacity: 0 and clips shift rects to the visual viewport. Some of these match the spec's rules and some go past them; the changelog doesn't always say which.
The score multiplies how much of the viewport moved by how far
Once the unstable node set is known, the layout shift value section reduces it to one number per frame, in two halves.
The impact fraction is about area. Each unstable node contributes its node impact region: the union of its visual representation now and in the previous frame, with points outside the viewport excluded. The document's impact region is the union of all of those, and the impact fraction is its area divided by the viewport's area. Overlapping nodes aren't double-counted, which makes this a union-of-rectangles problem; the spec notes that it's an instance of Klee's measure problem, solvable in O(n log n) with a sweep line and a segment tree.
The distance fraction is about the single worst move. Each unstable node's move distance is the larger of the horizontal and vertical components of its move vector, measured between starting points in viewport coordinates. The document's maximum move distance is the largest move distance among unstable nodes. The distance fraction divides that by the viewport base distance, which is the greater of the visual viewport's width and height, and caps the result at 1.0.
The layout shift value is impact fraction times distance fraction. The spec's note gives the reason for the second factor: a large element that moves a small distance can have a low impact on perceived instability. web.dev adds the history: the score was originally impact fraction alone, and distance was added to avoid over-penalizing that case.
A worked example, from first principles and in a browser
web.dev's first example is an element that fills the top half of the viewport and moves down by 25% of the viewport height. Here it is with numbers. Take a 400 × 800 viewport and a 400 × 400 block at the top. Something above it grows by 200 px.
- Previous visual representation: y from 0 to 400. Current: y from 200 to 600. Their union runs from 0 to 600, so the impact region is 400 × 600 = 240,000 px² out of 320,000. Impact fraction 0.75.
- The starting point moved 200 px vertically and 0 horizontally, so the move distance is 200. The viewport base distance is max(400, 800) = 800. Distance fraction 0.25.
- Layout shift value 0.75 × 0.25 = 0.1875.
Fig. 1 animates exactly that frame pair: the two rectangles, their union, and the move distance measured against the viewport's longer side.
impact region 400 × 600 = 75% of viewport impact fraction 0.75
move distance 200 px
viewport base distance = max(400, 800) = 800 distance fraction 0.25
0.75 × 0.25 = 0.1875 Chrome 155 reported 0.1875
I wanted to know whether Chrome agrees with the arithmetic, so I built that page and measured it. The method for every measurement in this piece is the same: Google Chrome 155.0.8059.80 on macOS, headless, driven by Playwright 1.64.1 with deviceScaleFactor 1, a PerformanceObserver for layout-shift registered before any content, three runs per case. Chrome 155 reached stable on 6 October 2026 according to Chromium Dash. Every value below was identical across the three runs. These are single-page tests of the definition, not field data.
The page reported one entry with a value of 0.1875 and a single source whose rectangle moved from y = 0 to y = 200. The spec's arithmetic and Chrome's implementation agree to four decimal places.
The second test shows why the viewport base distance matters more than people expect. I pushed content that fills the viewport down by 90 px in two viewports:
| Viewport | Impact fraction | Base distance | Distance fraction | Reported value |
|---|---|---|---|---|
| 1280 × 720 | 1.0 | 1280 | 90 / 1280 | 0.0703 |
| 390 × 844 | 1.0 | 844 | 90 / 844 | 0.1066 |
The same 90 px shift costs half again as much on a portrait phone, because the base distance is the phone's height rather than a desktop's width. On the phone, that one shift is above the 0.1 "good" threshold on its own. If your desktop CLS is fine and your mobile CLS isn't, check whether the same injected element is the cause before you look for a mobile-specific one.
The arithmetic as code
Here's the spec's computation for a handful of nodes, written to check numbers like the ones above. The inputs are each node's border box in viewport coordinates, before and after, the shape you'd get from getBoundingClientRect(). It assumes horizontal, left-to-right writing (so the starting point is the top-left corner), one box per node, and that the nodes have already passed the instability tests. It skips the 3 px significance check and uses a simple quadratic union instead of the spec's segment tree, which is fine for a few rectangles.
type Rect = { x: number; y: number; width: number; height: number };
type NodeShift = { previous: Rect; current: Rect };
// Points outside the viewport never count toward the impact region.
function clip(r: Rect, vw: number, vh: number): Rect | null {
const x1 = Math.max(0, r.x);
const y1 = Math.max(0, r.y);
const x2 = Math.min(vw, r.x + r.width);
const y2 = Math.min(vh, r.y + r.height);
if (x2 <= x1 || y2 <= y1) return null;
return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 };
}
// Area of a union of rectangles: slice by x, merge y-spans per slice.
function unionArea(rects: Rect[]): number {
const xs = [...new Set(rects.flatMap((r) => [r.x, r.x + r.width]))]
.sort((a, b) => a - b);
let area = 0;
for (let i = 0; i < xs.length - 1; i++) {
const [left, right] = [xs[i], xs[i + 1]];
const spans = rects
.filter((r) => r.x <= left && r.x + r.width >= right)
.map((r) => [r.y, r.y + r.height])
.sort((a, b) => a[0] - b[0]);
let covered = 0;
let end = -Infinity;
for (const [top, bottom] of spans) {
if (bottom <= end) continue;
covered += bottom - Math.max(top, end);
end = bottom;
}
area += covered * (right - left);
}
return area;
}The value itself is then a few lines. The move distance uses the unclipped starting points, as the spec does, while the impact region uses the clipped boxes.
export function layoutShiftValue(
nodes: NodeShift[],
vw: number,
vh: number,
): number {
const region = nodes
.flatMap(({ previous, current }) => [
clip(previous, vw, vh),
clip(current, vw, vh),
])
.filter((r): r is Rect => r !== null);
const impact = unionArea(region) / (vw * vh);
const moves = nodes.map(({ previous, current }) =>
Math.max(
Math.abs(current.x - previous.x),
Math.abs(current.y - previous.y),
),
);
const distance = Math.min(Math.max(0, ...moves) / Math.max(vw, vh), 1);
return impact * distance;
}
layoutShiftValue(
[{
previous: { x: 0, y: 0, width: 400, height: 400 },
current: { x: 0, y: 200, width: 400, height: 400 },
}],
400,
800,
); // 0.1875Two consequences of the formula are worth holding on to. First, the maximum move distance comes from the single node that moved furthest, while the impact region comes from all of them. A small badge that jumps 400 px drags up the distance fraction for a frame in which a large block moved 5 px. Second, area outside the viewport is free, but distance isn't clipped. A node that starts far above the viewport and moves into it brings its whole move distance with it; an open spec issue from 2020 points out that this penalizes an element more the further offscreen it started, even though the user sees the same thing arrive.
"Unexpected" means no discrete input in the last 500 ms
Not every shift is the page's fault. If you click "Show more" and the list grows, the movement is the response you asked for. The API handles this with two attributes on each entry, and the definitions are short enough to quote.
The input exclusion section defines an excluding input as "any event from an input device which signals a user's active interaction with the document, or any event which directly changes the size of the viewport". It says excluding inputs "generally include" mousedown, keydown, pointerdown and change. Then it carves out two exceptions: an event whose only effect is to begin or update a flick or scroll gesture isn't an excluding input, and neither are mousemove and pointermove. The user agent may delay reporting shifts after a pointerdown until it knows whether that touch is starting a scroll.
The report the layout shift steps then set lastInputTime to the time of the most recent excluding input (or 0 if there's been none), and set hadRecentInput to true "if lastInputTime is less than 500 milliseconds in the past". The entry's startTime is the current time at the rendering update that reports it. That's the whole mechanism. The API doesn't decide anything is "expected"; it stamps each entry with how long ago the user last did something discrete, and leaves the filtering to whoever computes the metric.
Three practical rules fall out of that wording:
- The clock starts at the input event, not at your handler or your fetch. In my banner runs
lastInputTimewas about 1 ms earlier thanperformance.now()inside theclicklistener. That fits the spec's list:clickisn't on it, so the timestamp belongs to thepointerdownormousedownthat came first. - The clock stops at the rendering update that reports the shift, not when you mutated the DOM. A mutation at 495 ms that isn't painted until the next frame can land outside the window.
- Scrolling, hovering and moving the pointer never open the window. The optimization guide spells this out: content that shifts while the user scrolls or holds the pointer over it counts as unexpected, even within 500 ms.
The banner demo
To see the boundary, I built a page with a 48 px-tall "Show offers" button at the top, an empty slot under it, and an article below. Clicking the button schedules a setTimeout that inserts a 120 px banner into the slot, standing in for a fetch that resolves after a delay. The viewport is 390 × 844. Here's the part that matters:
const slot = document.getElementById('slot');
const delay = Number(new URLSearchParams(location.search).get('delay'));
document.getElementById('load').addEventListener('click', () => {
// Stands in for a fetch that resolves `delay` ms after the click.
setTimeout(() => {
const banner = document.createElement('div');
banner.style.height = '120px';
slot.append(banner);
}, delay);
});Every run produced either zero or one layout-shift entry, and the shifted node was always the article, never the banner:
| Delay after click | Entry value | hadRecentInput |
Counted toward CLS |
|---|---|---|---|
| 400 ms | 0.1341 | true | no |
| 450 ms | 0.1341 | true | no |
| 550 ms | 0.1341 | false | yes |
| 600 ms | 0.1341 | false | yes |
| 600 ms, space reserved | no entry | n/a | no |
The 0.1341 checks out by hand: the article's visible part moved from y = 48 to y = 168, so the union covers y = 48 to 844 (an impact fraction of 796 / 844, about 0.943), and the move distance is 120 / 844, about 0.142. The same visual jolt is free at 450 ms and costs more than the whole "good" budget at 550 ms. Fig. 2 shows the three runs side by side.
The fix that made the last row read "no entry" is one CSS rule. In the test page the banner is 120 px tall at 390 px wide, so reserving that ratio gives the slot the banner's box before the banner exists. The banner then fills a box that's already there, and nothing else moves:
/* Reserve the banner's box before it exists. */
#slot {
aspect-ratio: 390 / 120;
}For a banner whose height doesn't scale with width, min-height: 120px is the more honest rule; the optimization guide suggests min-height for fixed slots and aspect-ratio for responsive ones. aspect-ratio is Baseline widely available as of today, so there's no compatibility reason to skip it.
The guide's note on slow responses is the real lesson of the table. If the content needs a network round trip that may exceed 500 ms, reserve the space inside the window, at click time, and take any shift then. The later arrival lands in a box that already exists.
Where the 500 ms rule is fuzzy
web.dev and Chrome don't quite agree about drags. The CLS article's caution says hadRecentInput is only true for discrete events such as tap, click or keypress, and that continuous interactions such as scrolls, drags, or pinch-zoom aren't "recent input". But Chrome's changelog for Chrome 93 says Chrome now buffers shifts during a mouse drag or resize and sets hadRecentInput when the mouseup arrives, so mouse drags and resizes get an exclusion. The spec still lists mousemove and pointermove as non-excluding; a pull request to make them excluding during drags and resizes has been open since May 2021. I'd trust the Chrome changelog for what Chrome does with mouse drags, and treat touch drags as unconfirmed.
The window also has an edge inside a single frame. Chrome's Michal Mocny opened an issue in 2024 pointing out that the 500 ms boundary can fall in the middle of an animation frame, so layout that's forced early in the frame can be excluded while layout computed lazily at the end of the same frame counts. And a 2026 issue argues the opposite problem: that the exclusion is too broad, and should only forgive shifts attributed to elements that were already on the page before the input, not to elements added after it. Neither has a resolution.
Session windows live on web.dev, not in the spec
Up to here everything has been about single entries. CLS, the number in CrUX, is an aggregation of entries, and the aggregation is where spec and metric part ways.
The spec's non-normative CLS section defines two scores. The document cumulative layout shift (DCLS) is the sum of every layout shift value reported in one browsing context. The cumulative layout shift (CLS) is the sum for the top-level browsing context plus, for each descendant frame, its values multiplied by a subframe weighting factor: the fraction of the top-level viewport occupied by that frame's viewport. Both are sums over the page's whole lifetime. The section says they're non-normative because the API doesn't expose them. It doesn't mention hadRecentInput, an omission an open issue from 2022 points out; only the usage example filters on it.
That usage example has a small bug of its own, if I'm reading it right. Inside its for loop it writes if (entry.hadRecentInput) return;, which exits the whole observer callback at the first excluded entry and silently drops any unexcluded entries later in the same batch. continue is what it means. The equivalent line in web-vitals is fine, because it sits in a per-entry method.
The metric Google uses is different. The web.dev definition calls CLS "a measure of the largest burst of layout shift scores" over the page's lifecycle. A burst, or session window, is one or more shifts with less than 1 second between each, and a maximum of 5 seconds for the whole window. CLS is the window with the largest total. Chrome's changelog dates the switch to Chrome 91, with field tools showing it from 1 June 2021, and notes that the trace events and the PerformanceObserver API didn't change at all. Only the aggregation did.
The spec never caught up. An issue titled "Update CLS to window-based" was opened in August 2021 and has no comments. The 17 December 2025 draft still describes lifetime sums. If you implement CLS from the spec alone, you'll get a different, larger number than Google's for any page with more than one burst.
Why these windows
The Chrome team explained the choice in Evolving the CLS metric in April 2021. They implemented the shortlisted options in Chrome and analyzed them over millions of pages. They rejected averaging windows because removing a tiny shift from a page could nearly double its score by deleting a low-scoring window from the average. They picked 5 seconds because shorter windows would reward slower pages, whose shifts split into more windows, and kept a cap at all because some pages, such as a sports score page, produce a continual stream of small shifts that don't get more annoying over time. Their analysis said 55% of origins would see no change at p75, no page would get worse, and about 3% would move into "good", mostly infinite scrollers and pages with many slow UI updates.
Here's the aggregation as code. It mirrors the logic in web-vitals' LayoutShiftManager: an entry joins the current window if it's less than 1,000 ms after the previous entry and less than 5,000 ms after the window's first entry, measured on startTime.
type Shift = { startTime: number; value: number; hadRecentInput: boolean };
export function cls(entries: Shift[]): number {
let max = 0;
let session = 0;
let first = 0;
let last = 0;
for (const entry of entries) {
if (entry.hadRecentInput) continue;
const joins =
session > 0 &&
entry.startTime - last < 1000 &&
entry.startTime - first < 5000;
if (joins) {
session += entry.value;
} else {
session = entry.value;
first = entry.startTime;
}
last = entry.startTime;
max = Math.max(max, session);
}
return max;
}A ticker, measured
To watch the cap work, I built the sports-score case from the Chrome team's post: a page whose content is pushed down by a new 20 px row every 900 ms, eight times. Chrome 155 reported eight entries, from 0.0237 for the first row down to 0.0198 for the eighth (each later row moves a slightly smaller visible area). Every gap is 900 ms, under the 1 s limit, so the gap rule never splits them. The 5 s cap does: the first six entries span 4.5 s and form one window worth 0.1338; the seventh arrives 5.4 s after the window opened and starts a new one, which ends at 0.0401. Fig. 3 plays that sequence.
The lifetime sum of all eight entries is 0.1739; the session-window CLS is 0.1338. Both fail the 0.1 threshold, and both count the same visible behavior. The difference grows with time on page: the session-window score is bounded by whatever fits into 5 seconds, while the spec's lifetime sum keeps climbing for as long as the ticker runs.
Which document, which frames, which page view
The spec's two scores differ on frames, and that difference is live in practice. The web.dev article says the API doesn't report shifts inside iframes, but the metric includes them because they're part of the user's experience. CrUX measures inside the browser, so it sees iframe content that page JavaScript can't, even same-origin frames. The web-vitals README draws the conclusion: given the lack of iframe support, onCLS() technically measures DCLS rather than CLS on pages with iframes. A page with an ad iframe that resizes its own content can have a CrUX CLS that your RUM can never reproduce.
Page views are a definition too. web.dev says a page restored from the back/forward cache should reset CLS to zero, because users experience it as a new visit, and CrUX counts bfcache restores as page navigations. Chrome's changelog credits the broad bfcache rollout in January 2022 with big CLS improvements across the web, because restored pages skip their load-time shifts. web-vitals 6.2.0 fixed a case of a spurious CLS report of 0 after a bfcache restore; the current release is 6.2.3, published on 5 October 2026. And the onCLS source only starts reporting once First Contentful Paint has been reported, with a comment saying this matches CrUX's behavior. Because onFCP drops an FCP that happens after the page was first hidden, a page loaded in a background tab reports no CLS at all.
Soft navigations add another boundary. With reportSoftNavs: true, the README says CLS is reset at each soft navigation in Chromium 151 and later, so one long SPA session becomes several page views, each with its own windows. CrUX now publishes experimental soft-navigation variants: in its September 2026 release, 81.7% of origins had good CLS under the standard definition and 85.1% with soft navigations included. PRF-06 in this series covers what that changes; for CLS the point is that the same shifts score differently depending on where a page view is allowed to end.
The sources array names the victims, not the culprit
Each entry carries up to five LayoutShiftAttribution objects in sources, each with a node, a previousRect and a currentRect. The report the layout shift sources steps choose them from the unstable node set: a node whose impact region is a subset of one already chosen is skipped, a node that contains one already chosen replaces it, and once there are five, a larger newcomer replaces the smallest. The spec says the choice of 5 is arbitrary.
The introduction is candid about what this can't tell you. If a newly inserted element shifts content below it, sources reports only the shifted elements, not the inserted one, and the editors write that they don't believe root-cause attribution is feasible for the user agent. The request to expose causes has been open since 2019. Lighthouse has the same limitation, and the optimization guide warns that the elements it lists are often the ones impacted rather than the ones causing the shift.
My demos show this sharply. In every banner run, the single source was the article, never the banner. In the feed tests below, five list items were reported for a shift that moved more than five, and the inserted 300 px block never appeared. Your debugging job is always to work backwards from the victims to whatever appeared above them in the same frame.
Two Chrome 145 changes made attribution more usable. Chrome now reports the rectangles in CSS pixels rather than physical pixels, consistent with getBoundingClientRect(), and sorts sources by impact area, largest first, so sources[0] is the biggest contributor. Both landed in the spec in December 2025, in pull requests #125 and #126. Chrome 145 reached stable on 10 February 2026 per Chromium Dash. Neither changed any score, but RUM code that assumed device pixels, or that scanned for the largest source, now behaves differently on Chrome 145 and later. Ties keep whatever order the implementation produces: in my overflow-anchor: none feed test, four posts with identical impact areas came back as posts 15, 16, 13 and 14, followed by the partly visible post 12.
A logging observer that you can paste into DevTools looks like this. It feature-detects first, because outside Chromium the entry type doesn't exist:
if (PerformanceObserver.supportedEntryTypes.includes('layout-shift')) {
new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.log(
Math.round(entry.startTime),
entry.value.toFixed(4),
entry.hadRecentInput ? 'excluded' : 'counted',
entry.sources.map((s) => s.node),
);
}
}).observe({ type: 'layout-shift', buffered: true });
}In production, onCLS from web-vitals/attribution reports largestShiftTarget, largestShiftValue and largestShiftTime for the single largest shift in the window that set the score, which is usually where to start. One detail: the README describes the target as the first shifted element in document order, but the attribution source takes the first element node in the sources array. On Chrome 145 and later that's the largest contributor, because of the new sort; on older builds it was whatever came first.
Feeds show what CLS misses and what it counts
The infinite-scroll case is where the definition earns its keep and where it surprises people, so I tested four variants. A feed of 40 posts, each 120 px tall, in a 390 × 844 viewport. The test scrolls 1,500 px with the mouse wheel, waits 400 ms, then inserts a 300 px block somewhere without any input. Because the wheel isn't an excluding input, none of these shifts can hide behind hadRecentInput:
| Where the block goes | Scroll position after | Entry value |
|---|---|---|
| Appended at the end of the feed | 1500 (unchanged) | no entry |
| Prepended at the top, default scroll anchoring | 1800 | no entry |
Prepended at the top, overflow-anchor: none |
1500 (unchanged) | 0.3555 |
| Inserted inside the viewport, above post 15 | 1500 (unchanged) | 0.2291 |
The first row is the case CLS was designed to forgive: content below the viewport moves nothing visible. The second is more interesting. Chrome's scroll anchoring picked an anchor node in the viewport and moved the scroll position by exactly 300 px to keep it still, so nothing on screen moved and no node shifted. overflow-anchor became Baseline newly available on 14 September 2026 when Safari 27 shipped it. Turn anchoring off and the same insertion moves the entire viewport by 300 px: an impact fraction of 1.0 times a distance fraction of 300 / 844, which is 0.3555, "poor" in a single frame. The fourth row moves only what's below the insertion point: 544 / 844 of the viewport by 300 px, or 0.2291.
Chrome's changelog shows these interactions have been tuned. Chrome 93 fixed a case where offscreen shifts countered by scroll anchoring during a user scroll were still being counted.
What the score systematically can't see
Putting the definitions and the tests together, these are the visible changes CLS ignores by construction:
- Movement by transform. I ran the same 300 px, one-second downward move twice: once animating
topon a relatively positioned box from0, once animatingtransform: translateY(). Thetopversion produced 60 entries, one per frame, adding up to 0.042, all in one window. The transform version produced none. The page looks identical. (A trap I hit on the way: animatingtopfrom its initialautodoesn't interpolate, so the box jumps at the halfway point and you get one 0.0864 entry instead.) - Content that changes without moving. An image swapped for a different image of the same size, a skeleton replaced by text of the same height, a flash of a different font that keeps line boxes in place. No starting point moves, so nothing is unstable.
- Invisible movement that becomes visible. Anything with
visibilityother thanvisibleoropacity: 0, on itself or an ancestor, in either frame, is excluded. A block that's laid out underopacity: 0, shifts, and then fades in never scores. - Scrolling. Including programmatic scrolls, including scroll containers, and including scroll anchoring adjustments. A page that yanks the user's scroll position to somewhere they didn't ask to go is disorienting, and it scores 0.
- Sideways carousels. Inline clip crossers are exempt as long as they don't also move in the block direction.
- Anything inside an iframe, from the page's point of view, and anything at all in Safari or Firefox.
And these are the ones it counts that people don't expect:
- Shifts during scrolling or hover, such as lazy images without reserved space arriving as the user scrolls, or menus that push content on hover. The optimization guide names both as common post-load causes.
- Slow responses to clicks. An SPA route transition that takes 700 ms to render is "unexpected" by definition, however clearly the user asked for it. The guide calls out SPA transitions that exceed the 500 ms grace period.
- Late banners and consent prompts that push content instead of overlaying it.
- Layout-property animations, which score every frame even when they're smooth and intended.
Some things moved between the lists over time. Chrome 88 stopped penalizing content-visibility: auto content when it switches between skipped and rendered, though the changelog notes that adjacent onscreen elements can still shift. The same release started counting shifts of fixed-position elements and of descendants of sticky elements, which raised scores for some sites. That's the theme of PRF-01 again: a stable metric's definition is a moving target, and the changelog is the only record.
Lab tools add a final blind spot. The CLS article cautions that lab tools typically measure only shifts during load, so lab CLS can be lower than what users see. By that caution, every post-load case in this section, the banner, the feed and the slow route, is invisible to a lab run that only loads the page, because none of them happens without a click, a scroll or a timer firing after load.
Reserve space, insert on intent, animate with transforms
The recommendations follow from the mechanism rather than from a checklist.
Give every late-arriving box its size before it arrives. Use width and height attributes on images and video, which browsers turn into a default aspect ratio, or aspect-ratio and min-height on slots for ads, embeds and banners, as the optimization guide describes. The test above went from 0.1341 to no entry with one CSS rule. Don't collapse the reserved space when an ad doesn't fill; the guide notes that removing reserved space can cause as much CLS as inserting content.
If you can't reserve space, insert where it moves the least. The formula is explicit about why: content injected near the top of the viewport moves more area. The guide recommends placing late content lower on the page. For feeds, append below the viewport, or insert above it and let scroll anchoring absorb the move; never turn anchoring off on a feed unless you're handling the scroll position yourself.
Make insertions answer an input, and answer within 500 ms. "Load more" and "Show new posts" buttons convert unexpected shifts into excluded ones, and the guide recommends having the user initiate new content. But the window is short. If the response may take longer, reserve the space or show a placeholder at click time, so the shift happens inside the window and the late arrival fills a box that already exists.
Animate with transform. It's the one change the definition is built to ignore, and the guide says composited translate animations don't count toward CLS. My test went from 60 entries to none. Respect prefers-reduced-motion while you're at it.
Keep pages bfcache-eligible. A restored page has no load-time shifts, and the guide calls bfcache eligibility a highly effective way to keep CLS low.
Measure across the page's life, in Chromium, and say so. Report CLS every time the page is hidden, which the CLS article recommends because mobile browsers often never run unload handlers, compute windows on the server or use web-vitals, and label the number "Chromium users only". When CrUX and your RUM disagree on a page with iframes, assume CrUX is seeing frame content you can't. For Safari and Firefox users you need a different stability signal, and PRF-05 in this series looks at what cross-browser comparison is and isn't possible. My own default for a team starting out: ship onCLS from web-vitals/attribution, keep largestShiftTarget and largestShiftTime with every beacon, and investigate any page where the largest shift comes more than a second after load, because that's the class of shift your lab runs will never show you.
What we don't know
Whether any other engine will implement Layout Instability. Mozilla's 2020 position is positive and its implementation bug is still open at P3; WebKit has no position on the core API, only an open sub-feature request whose one comment says WebKit doesn't implement the API. Movement on the Gecko bug, or a WebKit position issue on the API itself, would settle it.
Whether the spec will adopt session windows. The 17 December 2025 draft defines CLS as a lifetime sum, and the issue to change that has had no comments since 2021. Until it changes, the metric's definition lives on web.dev and in Chrome's changelog, and an independent implementation following the spec would report different numbers.
How CrUX weights iframe shifts. The spec proposes a subframe weighting factor by viewport fraction; web.dev says only that the metric includes iframe shifts. I couldn't find a document saying whether CrUX applies that weighting, sums frames into session windows together, or does something else.
What Chrome does with pinch-zoom and touch drags. The spec treats viewport-size changes as excluding inputs, web.dev says pinch-zoom and drags aren't "recent input", and Chrome's changelog only describes mouse drags and resizes. I didn't test touch input; a test with emulated touch on Chrome for Android would settle it for that build.
Whether the 500 ms rule will narrow or widen. Open spec issues argue both that the window splits frames inconsistently and that it forgives too much after clicks. Either change would move scores for SPA-heavy sites without any code change on their side.
How far my measurements generalize. They come from one Chrome build (155.0.8059.80), headless on macOS, at deviceScaleFactor 1, on deliberately minimal pages. They confirm the definition's arithmetic and boundaries; they say nothing about how common these cases are in the field or how other Chromium builds and devices behave.
References
- Layout Instability API (Draft Community Group Report, 17 December 2025). WICG>. Accessed .
- Layout instability performance entries. Web Platform Status (webstatus.dev)>. Accessed .
- browser-compat-data: api/LayoutShift.json. MDN>. Accessed .
- browser-compat-data: api/LayoutShiftAttribution.json. MDN>. Accessed .
- web-features: layout-instability.yml. W3C WebDX Community Group>. Accessed .
- Mozilla standards position: Layout Instability API (#374). Mozilla>. Accessed .
- Mozilla standards position: Layout Instability API CSS pixel attribution (#1318). Mozilla>. Accessed .
- WebKit standards position: Layout Instability API CSS pixel attribution (#588). WebKit>. Accessed .
- Bug 1651528: Implement Layout Instability API ("layout shift"). Mozilla Bugzilla>. Accessed .
- Cumulative Layout Shift (CLS). web.dev (Google)>. Accessed .
- Optimize Cumulative Layout Shift. web.dev (Google)>. Accessed .
- Evolving the CLS metric. web.dev (Google)>. Accessed .
- Why is CrUX data different from my RUM data?. web.dev (Google)>. Accessed .
- CrUX release notes. Chrome for Developers>. Accessed .
- Cumulative Layout Shift Changelog. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 145. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 91. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 93. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 90. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 89. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 88. Chromium (GitHub mirror)>. Accessed .
- Cumulative Layout Shift Changes in Chrome 97 (BFCache). Chromium (GitHub mirror)>. Accessed .
- Chromium Dash: release schedule. Chromium>. Accessed .
- web-vitals README. GoogleChrome (GitHub)>. Accessed .
- web-vitals CHANGELOG. GoogleChrome (GitHub)>. Accessed .
- web-vitals source: onCLS.ts. GoogleChrome (GitHub)>. Accessed .
- web-vitals source: LayoutShiftManager.ts. GoogleChrome (GitHub)>. Accessed .
- web-vitals package metadata. npm>. Accessed .
- Layout Instability issue #106: Update CLS to window-based. WICG (GitHub)>. Accessed .
- Layout Instability issue #113: DCLS and CLS definitions should mention hadRecentInput. WICG (GitHub)>. Accessed .
- Layout Instability pull request #103: mousemove and pointermove during dragging and resizing as excluding inputs. WICG (GitHub)>. Accessed .
- Layout Instability issue #123: hadRecentInput and animation frames. WICG (GitHub)>. Accessed .
- Layout Instability issue #127: Recent input exclusion and newly added elements. WICG (GitHub)>. Accessed .
- Layout Instability issue #68: CFC to adopt to WebPerfWG as a Working Draft. WICG (GitHub)>. Accessed .
- Layout Instability issue #11: Expose what caused the layout instability. WICG (GitHub)>. Accessed .
- Layout Instability pull request #126: sources sorted by impact area. WICG (GitHub)>. Accessed .
- Layout Instability issue #62: move distance penalty on extremely offscreen content. WICG (GitHub)>. Accessed .
- Layout Instability pull request #125: attribution rectangles use CSS pixels. WICG (GitHub)>. Accessed .
- web-vitals source: attribution/onCLS.ts. GoogleChrome (GitHub)>. Accessed .
- Largest Contentful Paint (W3C Working Draft). W3C>. Accessed .
- Event Timing API (W3C Working Draft). W3C>. Accessed .
- CSS Scroll Anchoring Module Level 1 (Editor's Draft). W3C CSS Working Group>. Accessed .
- overflow-anchor. Web Platform Status (webstatus.dev)>. Accessed .
- aspect-ratio. Web Platform Status (webstatus.dev)>. Accessed .