How to Fix CLS: Cumulative Layout Shift Guide

27 June 2026 4 min read Technical SEO

What CLS Measures

Cumulative Layout Shift (CLS) measures unexpected movement in the visible page layout. If a user is about to tap a button and the page jumps, that is a layout stability problem. The metric exists because visual stability is not a cosmetic issue; it affects trust, usability, and conversion.

Cumulative Layout Shift prevention diagram showing reserved space for images, ads and dynamic components

From an engineering perspective, CLS is usually a contract problem. The browser is not given enough information about how much space a component will occupy before it loads. The fix is to reserve space before the content arrives. The broader Core Web Vitals context is covered in our performance pillar page.

The Common Causes of CLS

CLS problems are usually predictable. They come from components that enter the layout late or change size after render.

Cause Why It Shifts Prevention
Images without dimensions Browser does not know the aspect ratio Add width, height, or CSS aspect-ratio
Ads and embeds Slot size changes after third-party content loads Reserve fixed or minimum dimensions
Web fonts Text reflows when custom fonts load Use font-display strategy and metric-compatible fallbacks
Cookie banners Banner pushes content after load Reserve space or overlay carefully
Dynamic recommendations Personalised content arrives late Use skeleton containers with fixed dimensions
Injected UI components DOM changes above visible content Avoid inserting content above existing content

The rule is simple: if a component can appear late, allocate its space early.

Create Layout Contracts for Components

A layout contract defines how much space a component is allowed to use before it loads. This is especially important for design systems, product cards, review widgets, video embeds, related posts, ads, and recommendation modules.

Practical rules:

  • Every image component needs dimensions or an aspect ratio.
  • Every embed component needs a reserved wrapper.
  • Every ad slot needs a known size range.
  • Every dynamic module needs a minimum height.
  • Every skeleton state should match the final component dimensions.
  • No component should inject new content above the user's current viewport without intent.

This is where teams often go wrong. They fix one image and call the issue solved. The better approach is to fix the component pattern so the same problem does not return on the next template.

Images, Video Embeds and Aspect Ratios

Images and video embeds are easy to fix when the team is disciplined. Add dimensions, preserve aspect ratios, and make sure responsive behaviour is predictable.

Image and Embed Checklist

  1. Add width and height attributes to images.
  2. Use CSS aspect-ratio for responsive media wrappers.
  3. Reserve space for YouTube, Vimeo, and iframe embeds.
  4. Avoid swapping placeholder images for final images with different dimensions.
  5. Keep captions and controls inside predictable containers.
  6. Test mobile layouts where aspect ratio changes are more obvious.

Video-heavy pages should also connect this work with video SEO. If the page contains an important video, pair stable embeds with accurate VideoObject schema and a video sitemap where relevant.

Fonts and Late UI Elements

Fonts can cause layout shift when fallback text renders at one size and the custom font renders at another. The fix is not always to remove custom fonts. The fix is to make font loading predictable.

Use sensible fallbacks, control font-display, preload critical fonts only when justified, and avoid loading multiple unnecessary font weights. Where possible, use fallback fonts with similar metrics to the final font.

Late UI elements need the same discipline. Cookie banners, newsletter boxes, sticky bars, chat widgets, and promo modules should either reserve space or overlay without moving core content. If a commercial widget causes layout shift and does not drive measurable revenue, remove it or redesign it.

How to Debug CLS

CLS debugging should be visual and repeatable. Use tools that show exactly which elements moved.

Workflow:

  1. Use PageSpeed Insights to identify affected templates.
  2. Open Chrome DevTools Performance panel.
  3. Record page load and interactions.
  4. Inspect layout shift events.
  5. Identify the shifting element and the element that caused it.
  6. Fix the component pattern, not only the single page.
  7. Re-test on mobile and slow network profiles.

External References

Frequently Asked Questions

What is CLS?
Cumulative Layout Shift (CLS) measures unexpected movement of visible page elements during load or interaction.
What causes CLS?
CLS is commonly caused by images without dimensions, ads, embeds, custom fonts, cookie banners, and dynamic components that load without reserved space.
How do you fix CLS?
Fix CLS by reserving space for images, ads, embeds and dynamic content, using stable font-loading strategies, and avoiding late insertion of content above the visible viewport.

Written by

Tony Morgan

Guest poster: Senior Technical SEO specialist

Tony is an SEO and digital strategy lead specialising in technical optimisation, content systems, and performance-driven website architecture.

With a hands-on background in development and automation, Tony focuses on building scalable SEO frameworks that combine clean code, structured content, and data-led decision making. His work spans technical audits, Core Web Vitals optimisation, entity-based content strategies, and custom tooling to support large-scale websites.

Tony takes a practical, engineering-first approach to SEO, favouring measurable improvements over surface-level tactics. He works closely with developers and content teams to ensure websites are not only discoverable, but genuinely useful for users and modern search engines.

Technical SEO and site architecture Core Web Vitals and performance optimisation Entity-based SEO and GEO strategies Content automation and structured data JavaScript SEO and renderability
View author profile
X Facebook LinkedIn WhatsApp Telegram Reddit Pinterest Email