A page can load quickly and still feel broken. A visitor on a phone is about to tap "Call now," a promo bar slides in above it, and the thumb lands on an ad or a menu link instead. That lurch is a layout shift, and Cumulative Layout Shift (CLS) is the Core Web Vitals metric that turns it into a number.
This guide explains what CLS actually measures, the five causes behind most real-world failures, the specific code and markup that fix each one, how to diagnose shifts with DevTools and the web-vitals library, and how to confirm the fix worked using field data rather than a one-off lab score. It ends with a checklist you can hand to a developer.
A layout shift happens when a visible element changes its start position between two rendered frames without the user having caused it. Each shift gets a score: impact fraction (how much of the viewport the moving elements affect, before and after) multiplied by distance fraction (how far they moved, as a share of the viewport's largest dimension). A hero image that pushes half the screen down by a quarter of the viewport height scores roughly 0.75 x 0.25, which is already about 0.19 from a single event.
CLS is not the sum of every shift on the page. Chrome groups shifts into session windows: a window ends after a one-second gap with no shifts or after five seconds total, and your CLS is the worst window. Shifts that begin within 500 milliseconds of a tap, click, or key press are excluded, because the user expected something to change.
Google's published thresholds, evaluated at the 75th percentile of real page loads, are:
- Good: 0.1 or less
- Needs improvement: above 0.1 up to 0.25
- Poor: above 0.25
The 75th-percentile rule matters. If a quarter of your visitors, often those on slow phones or weak connections, experience heavy shifting, the page fails even when your own fast laptop shows 0.00. CLS is one of three Core Web Vitals alongside LCP and INP. It is a page experience signal, not a dominant ranking factor, so the honest case for fixing it is twofold: it removes a small ranking drag and it protects conversions, since mis-taps and lost reading position cost leads on service pages where the call button is the whole point.
The classic offender is an image with no declared size. The browser lays out the text, then the file arrives, the box grows from zero to its real height, and everything beneath it jumps. The fix is to tell the browser the shape of the image before it downloads.
Put the intrinsic width and height attributes on every img. Modern browsers use them to compute an aspect ratio, so the box is reserved even when CSS makes the image fluid:
<img src="/img/van.webp" alt="Plumbing van outside a customer home"
width="1200" height="800" loading="lazy">
img { max-width: 100%; height: auto; }
That works with srcset too: the attributes describe the ratio, not the rendered pixel size. When you cannot set attributes, such as for CSS background images, a CMS-injected hero, or a video container, use the aspect-ratio property on the wrapper:
.hero { aspect-ratio: 16 / 9; width: 100%; background: #eee; }
.video-wrap { aspect-ratio: 16 / 9; }
.video-wrap iframe, .video-wrap video { width: 100%; height: 100%; }
A few related traps. Do not lazy-load the above-the-fold hero in a way that delays its box; dimensions keep it stable, but it should also load eagerly for LCP. Give video elements a poster and explicit dimensions. For Google Maps embeds on contact pages, set a fixed iframe height in CSS rather than letting it expand after load. And audit your theme or page builder: many generate img tags with attributes stripped, which is the most common reason a WordPress site fails CLS on image-heavy templates.
Anything that loads later and decides its own size is a risk: review carousels, booking widgets, chat bubbles, social feeds, video embeds, and display ads. The principle is simple: reserve the slot before the content arrives.
Wrap the embed in a container with a minimum height equal to the most common rendered size, measured on mobile first:
.reviews-slot { min-height: 420px; }
@media (min-width: 768px) { .reviews-slot { min-height: 300px; } }
.ad-slot { min-height: 250px; width: 300px; }
Several rules keep this honest:
- Reserve for the largest likely creative. If an ad slot can return 250 or 600 pixels, reserve the one that appears most often, or the larger one, and center smaller creatives inside it. A bit of whitespace is cheaper than a jump.
- Do not collapse empty slots. If no ad fills, keep the placeholder or the content below still moves.
- Place late-loading units where a shift cannot hurt. Slots below the first screen, or inside containers that are already off-screen, rarely register as large shifts because the impact fraction is small.
- Use a facade for heavy embeds. Show a fixed-size thumbnail and a play button, and load the real YouTube or Maps iframe only on click. Shifts caused by a click within 500 milliseconds are excluded, and you also save significant JavaScript.
- Never insert above existing content. If a widget must appear after load, append it below the fold or in a pre-sized slot.
For third-party scripts you do not control, the container with a reserved height is your only reliable defense, so check the vendor's documented dimensions and build around them.
Web fonts shift layout in two ways. With FOIT (flash of invisible text), text is hidden until the font loads, then appears. With FOUT (flash of unstyled text), the browser paints a fallback font first and swaps when the web font arrives. If the two fonts have different glyph widths or line heights, lines rewrap and the paragraph below moves.
Start with the loading behavior:
@font-face {
font-family: "Brand";
src: url("/fonts/brand-var.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
font-display: swap removes FOIT but allows FOUT. optional gives the font a very short window and, if it misses, keeps the fallback for that page view, which effectively eliminates font-driven shift at the cost of sometimes showing the system font on a first visit. Many local-service sites do well with optional for body text and swap for the logo or headings.
Then shrink the visual difference between fallback and web font with metric overrides, so a swap barely moves anything:
@font-face {
font-family: "Brand Fallback";
src: local("Arial");
size-adjust: 104%;
ascent-override: 92%;
descent-override: 24%;
line-gap-override: 0%;
}
body { font-family: "Brand", "Brand Fallback", sans-serif; }
The override values depend on your font; tools such as Fontaine, the Next.js next/font loader, and Capsize calculate them. Also preload the one or two critical files with <link rel="preload" as="font" type="font/woff2" crossorigin>, self-host instead of waiting on a third-party stylesheet, subset to the characters you need, and use a variable font to cut the number of requests. Fewer, earlier font files mean a shorter window in which a swap can happen.
Content inserted above something the user is already looking at is the most visible shift. Typical sources are cookie consent bars, promotional announcement strips, "now hiring" notices, sticky headers that change height on scroll, client-side personalization, and A/B testing tools that swap a headline after paint.
The fixes are structural:
- Overlay instead of push. A consent banner pinned with
position: fixed; bottom: 0floats over the page and moves nothing. A top bar can do the same, or reserve its height in the initial HTML. - Render in the server response. If the banner is needed on every visit, put it in the HTML with its height set, rather than injecting it with JavaScript after load.
- Reserve space for personalization. A "Serving Austin" greeting should occupy a fixed-height line whether or not the city lookup has finished.
- Avoid flicker-based A/B tests. Anti-flicker snippets hide the page, which hurts LCP; run tests server-side or on pre-sized components.
- Use skeletons with fixed dimensions for content fetched by API, such as hours, review counts, or pricing tables.
Animations deserve a separate note. Animating top, left, margin, height, or width triggers layout and can count as shift. Animate transform and opacity instead, which run on the compositor and do not move neighbors:
/* Causes layout shift */
.toast { top: -60px; transition: top .3s; }
.toast.show { top: 0; }
/* Does not */
.toast { transform: translateY(-100%); transition: transform .3s; }
.toast.show { transform: translateY(0); }
For an expanding accordion or FAQ, user-initiated changes within 500 milliseconds of the click are excluded, but anything that continues to shift longer, or that fires on a timer, is counted.
Guessing wastes time. Use tools that name the exact element.
Chrome DevTools, Performance panel. Record a page load with mobile emulation and 4x CPU throttling. The Layout Shifts track marks each shift; click one to see its score, the time, and the moved nodes. Open Rendering from the DevTools drawer and enable Layout Shift Regions to flash blue over anything that moves while you scroll and interact.
Lighthouse and PageSpeed Insights. The "Avoid large layout shifts" audit lists the elements contributing most. Remember Lighthouse measures a load in a clean lab, so it often misses shifts that happen after scrolling, after cookie consent, or from logged-in states.
The web-vitals library with attribution. This captures the same metric your visitors experience and tells you which element moved. Drop it into a test build or send results to your analytics:
import {onCLS} from 'web-vitals/attribution';
onCLS(({value, attribution}) => {
console.log('CLS', value,
'largest shift target:', attribution.largestShiftTarget,
'time:', attribution.largestShiftTime);
});
For a quick check with no library, a PerformanceObserver on layout-shift entries logs each event, where entry.hadRecentInput tells you whether it is excluded and entry.sources lists the moved nodes:
new PerformanceObserver(list => {
for (const e of list.getEntries()) {
if (!e.hadRecentInput) console.log(e.value, e.sources);
}
}).observe({type: 'layout-shift', buffered: true});
Test the real flows: scroll the entire page, open and dismiss the cookie banner, resize to mobile widths, and test with a cold cache. Shifts from lazy-loaded content only appear when you scroll to it. Run the same pass on your main templates (home, service page, city page, blog post, contact), because a single shared component usually explains failures across hundreds of URLs. A site-wide website SEO audit can flag the templates worth checking first.
A green Lighthouse run proves little, because CLS is judged on real users. Verify in layers.
- Lab confirmation. Re-record in DevTools and confirm the shift is gone on mobile emulation, including after scrolling.
- Field data from CrUX. The Core Web Vitals report in Search Console groups URLs by status and template. PageSpeed Insights shows the CrUX field section for the URL and origin. This data is a rolling 28-day window, so expect gradual improvement over roughly a month rather than an overnight flip.
- Your own real-user monitoring. Send
onCLSresults to analytics with page type and device as dimensions. You see the 75th percentile within days, and you catch regressions the same week a new plugin ships.
Always compare the 75th percentile, split by mobile and desktop, and by page template. If mobile fails and desktop passes, suspect banners, ads, and font swaps on narrow layouts. Re-check after every theme update, new tag in the tag manager, or added widget, since these are the usual regressions.
CLS fix checklist
- Every
imgandvideohaswidthandheight, or a wrapper withaspect-ratio. - Responsive images keep
height: autowith the attributes in place. - Ads, review widgets, maps, and embeds sit in containers with a reserved
min-height, and empty slots do not collapse. - Heavy embeds use click-to-load facades at a fixed size.
- Fonts are self-hosted, subset, preloaded for the critical weights, and use
font-displaywith fallback metric overrides. - Cookie, promo, and notice banners overlay the page or have reserved height in the initial HTML.
- No content is injected above existing content after load.
- Animations use
transformandopacity, not layout properties. - Client-fetched content has fixed-size skeletons.
- CLS measured with web-vitals attribution, and the 75th percentile is at or below 0.1 for each key template on mobile.
- Search Console CrUX status monitored for at least 28 days after deployment.
Layout stability is one part of a healthy technical foundation. For more fixes across speed, crawlability, and structured data, browse the rest of the RankLocalToday blog.
What is a good CLS score?
Google rates a CLS of 0.1 or lower as good, above 0.1 up to 0.25 as needs improvement, and above 0.25 as poor. The score is assessed at the 75th percentile of real page loads, so at least three quarters of your visitors must experience 0.1 or less for the page or origin to pass.
Does CLS affect local search rankings?
CLS is part of Google's page experience signals through Core Web Vitals, but it is one lightweight factor among many, and relevance and links matter far more. Treat it as a tiebreaker with a larger conversion benefit: stable pages prevent mis-taps on call and directions buttons, which directly affects leads.
Why is my CLS good in Lighthouse but poor in Search Console?
Lighthouse runs one clean, simulated page load. Search Console uses Chrome field data from real visitors over 28 days, including slow devices, cookie banners, scrolling, ads that vary by user, and late-loading content. Field CLS also counts shifts after the initial load, which lab tools usually miss. Trust the field data and reproduce its conditions.
Are layout shifts caused by clicks counted in CLS?
Shifts that begin within 500 milliseconds of a discrete user input, such as a tap, click, or key press, are flagged with hadRecentInput and excluded from CLS. That is why click-to-expand sections are generally safe. Shifts that happen later, or on a timer without any interaction, are still counted.
How long until CLS fixes show in Search Console?
Search Console and PageSpeed Insights field data come from the Chrome User Experience Report, a rolling 28-day window. After deploying fixes, expect the metric to improve gradually over about a month as old sessions drop out. Your own real-user monitoring will show the change within days, which makes it useful for faster validation.
Turn this into a practical SEO action plan
Use RankLocalToday tools to check rankings, diagnose website issues, and prioritize the next organic traffic move.
Get your SEO plan →More in this topic: Website SEO, all 208 guides →