Cumulative Layout Shift (CLS): why your page jumps while it loads, and how to stop it

Last updated

The short answer

Cumulative Layout Shift (CLS) measures how much your page jumps around while people are using it: text, buttons and pictures moving after they have appeared, usually because something above them arrived late. Google counts 0.1 or less as good and anything above 0.25 as poor (web.dev). The usual causes on a small-business site are pictures without a size, banners and cookie bars added at the top, embeds such as maps and booking widgets, and web fonts that swap in at a different size. Each one has a simple fix: keep the space free before the thing arrives.

This is the deep dive on one of the three Core Web Vitals. For all three and how they fit together, see Core Web Vitals explained.

What counts as a layout shift, and what doesn't

A layout shift is a visible element changing position from one moment to the next. It only matters when the visitor doesn't expect it (web.dev). The cost is real: someone goes to tap "Call now", a banner loads above it, and they tap something else instead.

CLSRating
0.1 or lessGood
Over 0.1, up to 0.25Needs improvement
Over 0.25Poor

As with the other Core Web Vitals, Google looks at the 75th percentile: three in four visits should be at or under the line, on phones and computers separately.

"CLS issue: more than 0.1 (mobile)": what it means

Search Console's Core Web Vitals report sorts your pages by status and issue, using the same bands: good up to 0.1, need improvement up to 0.25, poor above that (Search Console Help). So an issue that reads "CLS issue: more than 0.1" means pages in the needs-improvement band, and "more than 0.25" means poor. A few things about how the report works explain most of the confusion:

Why PageSpeed can pass while Search Console flags the page

PageSpeed Insights (pagespeed.web.dev) shows two different things. The top section is what real visitors experienced, when Google has enough of it. The section below is a lab test that loads the page once on a simulated phone. Lab tools can only measure layout shifts that happen while the page loads, so their CLS can be lower than real visitors' (web.dev). Real visits count movement for as long as the page is open.

web.dev suggests comparing the two (Optimize CLS). If the real-visitor CLS and the lab CLS are similar, the jump happens during loading and the lab test will show you where. If the real-visitor figure is much worse, something moves later: an advert that fills in after a few seconds, a chat bubble, a review carousel, an offer bar that appears as people scroll.

How do you find the element that moved?

  1. Watch it happen. Open the page on your own phone in a private window, on mobile data if you can, and watch the top of the screen as it loads. Then scroll slowly. Many jumps are obvious once you look for them.
  2. Read the lab test's list. The lab test lists the elements that shifted during loading and how much each added. These are often the elements that were pushed, not the ones that pushed them (web.dev), so look at what sits just above the element named.
  3. Record it in Chrome's developer tools. On a computer, open the page in Chrome, open the developer tools and record a reload in the Performance panel, then look at its layout shifts track. The "Layout shift culprits" insight gives Chrome's best guess at the cause: an image without a size, an injected frame such as an advert, a web font, or an animation (Chrome for Developers).

If the jump only happens later in a visit, the lab test won't catch it. Use the page the way a customer would, with the developer tools recording, until you see it.

The usual causes, and the fix for each

Every fix below comes down to the same idea: keep the space free before the content arrives, or put late content where it can't push anything (web.dev).

Pictures and videos without a size

Give every image and video its width and height. Modern browsers work out the shape from those two numbers and keep that space free before the file arrives. With height: auto in the CSS, the image still shrinks to fit a phone screen and keeps its shape:

<img src="/photos/team.webp" width="1200" height="800"
     alt="Our crew on a roof repair in Dallas">

/* Keeps its shape when the theme shrinks it to fit a phone */
img { height: auto; }

Use the photo's real size, or at least its real proportions. If the numbers describe a different shape from the file and the CSS forces both, the picture is drawn squashed or stretched. For responsive images, keep every version in the same proportions. Where to look for missing sizes: pictures added by plugins, sliders and gallery widgets, logos placed in the header by the theme, and any page someone coded by hand.

Banners and cookie bars added at the top

Cookie notices at the top of the screen are a very common source of layout shift (web.dev). Anything a script slots in above your content after the page has appeared behaves the same way. Either reserve the bar's space from the start, or lay it over the page, for example fixed to the bottom of the screen:

/* Laid over the page at the bottom, so nothing is pushed down */
.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; }

A notice that slides in can still cause shifts if the slide moves the page; see animations below. For what the consent banner itself has to do, see cookies and consent.

Maps, booking widgets, reviews and adverts

Embeds arrive after the page and often have no size until their script runs. Give each one a box of its usual size up front: a minimum height, or a fixed shape such as 16 by 9, set in the site's style code as in the example below. If the size varies, reserve the smallest likely size: a smaller jump is still better than one from nothing. Don't let an empty advert slot collapse; show a placeholder instead. Content that has to load late does least harm lower down the page.

/* A booking widget: keep at least its usual height free */
.booking-widget { min-height: 640px; }

/* The box a map or video sits in: keep its shape free before it loads */
.map-embed { aspect-ratio: 16 / 9; }

Web fonts that swap in at a different size

Many sites show your text straight away in a font the visitor already has, then swap in your own web font when it arrives. If the two fonts are different sizes, every line re-flows. There are three ways to stop it (web.dev). Hand this part to whoever built your site:

/* The stand-in: a font the visitor already has, resized to
   take the same space as your web font. A fallback-font
   generator gives you the four figures for your font:
   replace each capitalised word with one before using this. */
@font-face {
  font-family: "Brand Fallback";
  src: local("Arial");
  size-adjust: SIZE;          /* a percentage */
  ascent-override: ASCENT;    /* a percentage */
  descent-override: DESCENT;  /* a percentage */
  line-gap-override: LINEGAP; /* a percentage */
}

body { font-family: "Brand", "Brand Fallback", sans-serif; }

Animations that move the layout

Animating top, left, a height or a margin moves everything around the element. Animate with transform instead: it moves the element without triggering a layout shift (web.dev).

/* Avoid: animating the margin pushes the page below it */
.offer-bar { margin-top: -4rem; transition: margin-top 0.3s; }
.offer-bar.open { margin-top: 0; }

/* Better: transform moves only the bar itself */
.offer-bar { transform: translateY(-4rem); transition: transform 0.3s; }
.offer-bar.open { transform: translateY(0); }

How do you confirm the fix worked?

  1. Check the lab test first. Run PageSpeed Insights again on the page, on the phone result. The lab CLS should drop, and the shifted element should no longer be listed.
  2. Then tell Search Console. Open the issue in the Core Web Vitals report and start validation. Search Console watches the site for 28 days, and the issue counts as fixed only if no page shows it in that time (Search Console Help). "Looking good" along the way means the pages checked so far are fixed.
  3. If validation fails, some pages in the group still shift. Find what they have in common (a widget, a template, a plugin), fix it and start a new validation.

How the scan checks it

For a slow page rather than a jumpy one, see Largest Contentful Paint (LCP) and why your website is slow. For a page that is slow to react when tapped, see Interaction to Next Paint (INP).

Checklist

Questions people ask

What is a good CLS score?
0.1 or less. Between 0.1 and 0.25 needs improvement, and above 0.25 is poor. Google judges it on three in four visits, separately for phones and computers.
Why does PageSpeed Insights show a good CLS when Search Console says my pages have a CLS issue?
The lab test in PageSpeed loads the page once and only sees movement while it loads. Search Console uses real visits over the last 28 days, which include anything that moves later: an advert, a chat bubble, a review widget or a banner that appears after a few seconds.
How long until Search Console shows the fix?
When you validate a fix, Search Console watches the site for 28 days. The issue counts as fixed only if no page shows it during that time, because the report is built from the last 28 days of real visits.
Does content that moves when someone taps a button count?
No. Movement within half a second of a tap, click or key press is expected and left out. Scrolling doesn't count as a tap, so things that jump as someone scrolls still count.

What the free scan checks for this

These are the FocalScore checks that cover this guide's subject. Each one in your report says what it found, shows the evidence and gives the fix.

Sources

Last checked . Documentation, settings and rules change; if one of these pages now says something different, it is right and this guide is out of date. Tell us at info@focalscore.com.

  1. web.dev: Cumulative Layout Shift (CLS)
  2. web.dev: Optimize Cumulative Layout Shift
  3. Search Console Help: Core Web Vitals report
  4. Chrome for Developers: Layout shift culprits
  5. web.dev: Best practices for cookie notices
  6. MDN: size-adjust (@font-face descriptor)