MakeWebsite.Fast

What is CLS? Complete Guide to Cumulative Layout Shift

Comprehensive guide to Cumulative Layout Shift (CLS). Learn what CLS measures, good CLS scores, common causes of layout shifts, and proven techniques to achieve visual stability.

Published January 11, 2025Updated January 13, 202510 min read

Key Takeaways

  • 1CLS measures visual stability - aim for a score under 0.1
  • 2Always include dimensions on images and reserve space for dynamic content
  • 3Layout shifts frustrate users and hurt conversions - treat CLS as a UX metric, not just SEO

What is Cumulative Layout Shift (CLS)?

Cumulative Layout Shift (CLS) is one of Google's three Core Web Vitals metrics. It measures visual stability by quantifying how much unexpected layout shift occurs during the entire lifespan of a page.

CLS captures user frustration when page elements move unexpectedly. Have you ever tried to click a button, only to have it shift and click something else? That's what CLS measures.

A layout shift occurs whenever a visible element changes its start position from one rendered frame to the next. CLS is calculated by multiplying the impact fraction (how much of the viewport shifted) by the distance fraction (how far elements moved).

  • CLS measures unexpected movement of page elements
  • Good CLS: under 0.1 | Needs improvement: 0.1-0.25 | Poor: over 0.25
  • Only unexpected shifts count - user-initiated movements are excluded
  • CLS is measured throughout the page's entire lifecycle, not just initial load

Why CLS matters for SEO and user experience

CLS directly impacts user trust and conversion rates. When pages jump around unexpectedly, users feel the site is unreliable or broken. Studies show high CLS correlates with higher bounce rates.

Google includes CLS in Core Web Vitals because it reflects real user frustration. Poor CLS can lead to accidental clicks on ads or wrong links, creating terrible user experiences.

E-commerce sites are especially vulnerable to CLS issues. Imagine a user ready to click 'Add to Cart' when a promotional banner pushes the button down, causing them to click 'Remove from Wishlist' instead.

Pro tip: Research shows that reducing CLS by just 0.1 points can increase pageviews per session by 15% and reduce bounce rates significantly.

Common causes of layout shifts

Images and videos without dimensions are the most common CLS culprit. When the browser doesn't know the size of media in advance, it first renders with zero height, then shifts content when the media loads.

Web fonts that load after text has rendered cause FOIT (Flash of Invisible Text) or FOUT (Flash of Unstyled Text), both of which create layout shifts as text re-renders with different dimensions.

Dynamically injected content like ads, embeds, or iframes often cause massive shifts because space isn't reserved for them in advance.

  • Images and videos without width/height attributes
  • Web fonts causing FOIT/FOUT
  • Ads, embeds, and iframes without reserved space
  • Dynamically injected content (cookie banners, notifications)
  • Content loading above existing content
  • Animations that trigger layout recalculations

How to fix CLS issues

Always include width and height attributes on images and videos. Modern browsers use these to calculate aspect ratios before the media loads, reserving the correct space.

Use CSS aspect-ratio or padding-bottom hacks to reserve space for dynamic content like ads and embeds. If an ad slot is 300x250, reserve that space even before the ad loads.

Preload web fonts and use font-display: optional or font-display: swap with fallback fonts that have similar metrics to minimize text reflowing.

Pro tip: The key principle is simple: reserve space before content loads. If the browser knows how big something will be, it won't shift other content when it appears.

CLS optimization checklist

Follow this systematic approach to eliminate layout shifts. Test your changes in Chrome DevTools Performance panel, which highlights layout shifts in red.

Use MakeWebsite.fast to monitor your CLS score over time. Field data in Chrome User Experience Report shows real-world CLS, which may differ from lab tests.

  • Add width and height to all <img> and <video> elements
  • Use CSS aspect-ratio for responsive images
  • Reserve space for ads with min-height on containers
  • Preload web fonts with font-display: swap
  • Don't insert content above existing content
  • Use transform animations instead of layout-triggering properties
  • Add skeleton loaders that match final content dimensions
  • Test with slow 3G to see all layout shifts
Get weekly performance tips

Frequently Asked Questions

What is a good CLS score?+

A good CLS score is under 0.1. Scores between 0.1-0.25 need improvement, and scores over 0.25 are considered poor. Like other Core Web Vitals, Google measures CLS at the 75th percentile of page loads.

How do I find what's causing layout shifts?+

Use Chrome DevTools Performance panel - record a page load and look for 'Layout Shift' entries. Click on them to see which elements shifted. The Lighthouse report also lists specific CLS issues with element selectors.

Do CSS animations cause CLS?+

Only if they animate layout properties like width, height, top, or left. Animations using transform and opacity don't trigger layout shifts because they run on the compositor thread without affecting other elements.

M

MakeWebsite.fast Research

Performance Engineering Team

Our research team analyzes thousands of websites weekly to identify performance patterns and best practices. We translate complex technical concepts into actionable guidance.

Verified AuthorExpert ContentRegularly Updated
Share this article:

Ready to optimize your website?

Test your site's Core Web Vitals and get actionable recommendations.

Performance Newsletter

Weekly tips to make your website faster

Join 5,000+ developers getting actionable performance optimization tips, Core Web Vitals updates, and speed testing insights.

No spam. Unsubscribe anytime.