PH Ranking - Online Knowledge Base - 2025-09-05

How to Measure and Calculate CLS Scores Accurately

To measure and calculate Cumulative Layout Shift (CLS) scores accurately, you need to understand that CLS quantifies the visual stability of a webpage by measuring unexpected layout shifts during page load or user interaction.

How CLS is Calculated

  1. Identify Layout Shifts: A layout shift occurs when a visible element changes its position between two rendered frames without user interaction.

  2. Session Window: CLS is calculated within session windows triggered by layout shifts. A session window lasts until 1 second passes without a new layout shift or a maximum of 5 seconds.

  3. Calculate Layout Shift Score for Each Shift:

    • Impact Fraction: Measures how much space the unstable element occupies in the viewport. It is the ratio of the impact region area (the union of all shifting elements) to the total viewport area.
    • Distance Fraction: Measures how far the element moves relative to the viewport's largest dimension (width or height).
  4. Formula:
    [ \text{Layout Shift Score} = \text{Impact Fraction} \times \text{Distance Fraction} ]

  5. Final CLS Score: The CLS score for the page is the sum of all layout shift scores within the session window with the highest total score.

Example Calculation

  • If an element occupies 60% of the viewport and shifts by 30% of the viewport height:
    • Impact Fraction = 0.9 (90% of viewport area affected)
    • Distance Fraction = 0.3 (30% of viewport height moved)
    • CLS score = 0.9 × 0.3 = 0.27

Measuring CLS in Practice

  • Lab Data: Use tools like Chrome DevTools or Lighthouse to measure CLS during initial page load in a controlled environment.
  • Field Data: Use real user monitoring tools such as Google PageSpeed Insights, Chrome User Experience Report (CrUX), BigQuery, or Looker Studio to capture CLS as experienced by actual users, including shifts caused by scrolling or interaction.

Tools for Accurate Measurement

  • Chrome DevTools & Lighthouse: Provide immediate CLS scores but only for lab conditions.
  • PageSpeed Insights: Offers CLS scores for both mobile and desktop from real user data.
  • Third-party Monitoring Tools: Provide continuous CLS monitoring and alerts for layout shift issues.

Important Notes

  • CLS can differ between lab and field data because lab tests only capture shifts during initial load, while field data includes shifts during user interaction.
  • Monitoring CLS over time and across different devices and screen sizes helps identify and fix layout instability effectively.

By following this method—calculating impact and distance fractions for each layout shift within session windows and summing the highest window score—you can measure and calculate CLS scores accurately to improve your website’s visual stability and user experience.

Internet images

PH Ranking offers the highest quality website traffic services in Philippines. We provide a variety of traffic services for our clients, including website traffic, desktop traffic, mobile traffic, Google traffic, search traffic, eCommerce traffic, YouTube traffic, and TikTok traffic. Our website boasts a 100% customer satisfaction rate, so you can confidently purchase large amounts of SEO traffic online. For just 720 PHP per month, you can immediately increase website traffic, improve SEO performance, and boost sales!

Having trouble choosing a traffic package? Contact us, and our staff will assist you.

Free consultation

Free consultation Customer support

Need help choosing a plan? Please fill out the form on the right and we will get back to you!

Fill the
form