How to fix layout shift (CLS) on your website

What causes content to jump while pages load, how Cumulative Layout Shift is measured, and practical fixes for images, ads, fonts, banners and embeds.

By the UK Technology Hub teamPublished 4 minute read

The short answer

Layout shift happens when visible content moves unexpectedly while a page loads, often because images lack dimensions, ads and embeds load without reserved space, web fonts swap in with different sizes or banners are inserted above content. Google measures it as Cumulative Layout Shift (CLS), with 0.1 or less considered good. Find the shifting elements, reserve space for them and load late content without pushing others around.

You go to tap a link and the page jumps, so you tap an advert instead. That's layout shift, and it's frustrating. Google measures it through Cumulative Layout Shift (CLS), one of the Core Web Vitals. A good score is 0.1 or less for most visits.

Step 1: Find what's shifting

  • PageSpeed Insights shows CLS from real users where data exists, plus lab diagnostics listing elements that shifted.
  • Chrome DevTools can highlight layout shift regions as the page loads, and the Performance panel records shifts.
  • Search Console's Core Web Vitals report shows groups of pages with CLS problems.

Test on mobile, where shifts are often worse.

Common causes and fixes

Images without dimensions

If the browser doesn't know an image's size, it reserves no space, then pushes content down when the image loads.

Fix: set width and height attributes on images, or use the CSS aspect-ratio property. Responsive images still scale correctly when dimensions are set.

Videos and embeds

YouTube videos, maps, social posts and iframes often load late.

Fix: wrap them in containers with a fixed aspect ratio or minimum height.

Ads

Ads load asynchronously and vary in size.

Fix: reserve space for ad slots with minimum heights, avoid placing ads near the top of content, and avoid collapsing slots when no ad fills them.

Web fonts

When a custom font loads and replaces a fallback font with different metrics, text reflows.

Fix: preload important fonts, use font-display settings thoughtfully, and choose fallback fonts with similar metrics or use CSS font metric overrides to match sizes.

Late-inserted banners

Cookie banners, promotional bars and notifications inserted at the top push everything down.

Fix: reserve space for them from the start, or display them as overlays that don't move content, such as fixed bars at the bottom.

Dynamic content

Content loaded by JavaScript, such as recommendations or reviews, can push existing content.

Fix: reserve space with skeleton placeholders of the right size, or load content below the fold.

Animations

Animating properties like height or top causes layout shifts.

Fix: animate transform and opacity instead, which don't affect layout.

Shifts after interaction don't count

Layout changes within a short time after a user interacts, such as opening an accordion, don't count towards CLS. Problems usually come from content moving on its own.

Step 2: Retest

After fixes, retest with lab tools, then watch field data. Field data in Search Console updates over a rolling window, so improvements take a few weeks to show fully.

Why it matters beyond scores

Layout shift causes mis-taps, lost reading position and frustration. Fixing it improves user experience and conversion, not just metrics. A smoother experience can also support how search engines evaluate your pages; our guide to fixing "crawled, currently not indexed" discusses other quality signals.

Long-running scripts and memory problems can also make pages feel unstable. Our guide to fixing JavaScript memory leaks covers one cause of sluggish pages.

Single-page apps and CLS

In single-page applications, CLS can accumulate as users navigate between views without full page loads. Loading states, skeleton screens with correct sizes and stable layouts during route changes help. Test the whole journey, not just the first page.

Measuring on real devices

Lab tests on fast computers often miss shifts that happen on slower phones and networks, where resources arrive in a different order. Field data from real users, available in Search Console and PageSpeed Insights, shows the real picture.

A quick CLS checklist

  • Images and videos have dimensions or aspect ratios.
  • Ad and embed slots reserve space.
  • Fonts load without large reflows.
  • Banners and notices don't push content.
  • Dynamic content uses placeholders of the right size.
  • Animations use transform and opacity.

Check after changes

New ads, widgets, banners or design changes can introduce shifts. Retest key templates whenever you add new elements.

How we help

Our web development team builds pages with stable layouts from the start and fixes CLS on existing sites. Our e-commerce team stabilises product pages with reviews, recommendations and ads, and our maintenance plans monitor Core Web Vitals.

Frequently asked questions

What is a good CLS score?

0.1 or less for most visits is considered good by Google.

Do cookie banners cause layout shift?

They can if inserted above content. Use overlays or reserved space to avoid shifts.

Does CLS affect SEO?

CLS is part of Core Web Vitals, which form part of Google's page experience signals.

This guide is general information, not legal, tax or financial advice, and details such as prices, features and rules can change. Product and company names mentioned are trademarks of their respective owners and are used only to identify those products; UK Technology Hub is not affiliated with or endorsed by them.

Related guides

How to find and fix JavaScript memory leaks

What memory leaks look like in web apps, the most common causes, how to find them with browser developer tools, and patterns that prevent them.

How to fix the WordPress white screen of death

A calm, step-by-step guide to diagnosing and fixing a blank white WordPress page, from recovery mode and debug logs to plugins, themes and memory limits.

All bug fixes & troubleshooting guides