Speed & performance · Guide
How to Fix CLS (Layout Shift) in WordPress
Short answer
To fix cumulative layout shift in WordPress, add width and height to every image and video, reserve space for ads, embeds and banners before they load, and use font-display: optional with a close fallback font. Then animate with transform instead of top or left, and never lazy-load the first image on the page. Aim for a CLS score of 0.1 or less at the 75th percentile, and re-test in PageSpeed Insights after each fix.
Key takeaways
- A good CLS score is 0.1 or less at the 75th percentile, while scores above 0.25 are poor.
- Images without width and height are the most common cause of layout shift on WordPress sites.
- WordPress core can add loading=lazy and fetchpriority=high, but only when the image already has width and height.
- Shifts within 500 milliseconds of a click or tap do not count toward CLS.
- Reserve space for ads, embeds and banners, or show them as an overlay that does not push content down.
- Animate with transform, not top or left, to move elements without a new layout.
What is cumulative layout shift in WordPress?
Cumulative layout shift is the movement of visible page content after it first appears, measured as a single CLS score for the whole visit.
A layout shift happens when a visible element changes its start position between two frames, as web.dev explains in its CLS guide. On WordPress sites, the usual triggers are images without dimensions, web fonts that swap in late, and ads or embeds that load after the text.
The score is not a simple total of every move. CLS groups rapid shifts into a session window, and the largest window sets the page score. Shifts less than 1 second apart form one window, which lasts at most 5 seconds, according to the same web.dev guide.
What is a good CLS score for a WordPress site?
A good CLS score is 0.1 or less, measured at the 75th percentile of page loads for mobile and desktop separately.
Scores above 0.25 are poor, and scores between 0.1 and 0.25 need improvement, as shown in the web.dev CLS guide. Google Search Central gives the same target and lists CLS with loading and interactivity as one of the three Core Web Vitals.
CLS is a unitless number, not a time. A score of 0.18 does not mean 180 milliseconds. It comes from multiplying the impact fraction by the distance fraction, and web.dev shows the example 0.75 times 0.25 equals 0.1875.
How do you measure CLS on your WordPress site?
Measure CLS in PageSpeed Insights first, then confirm the result in Search Console, because the first shows real-user data and the second shows which pages fail.
- Open PageSpeed Insights, enter a page URL, and read the field CLS under “Discover what your real users are experiencing”.
- Read the lab CLS under “Diagnose performance issues” on the same report for the load-only figure.
- Open the Core Web Vitals report in Search Console and open the CLS issue to see the affected pages.
- Check mobile and desktop separately, since Google measures the 75th percentile for each device type.
Field data covers the full life of the page, while lab tools such as Lighthouse usually measure only the page load. The two numbers often differ for that reason, as web.dev notes in its guide to optimizing CLS.
CLS is only one of the three Core Web Vitals, so read our guide to what INP measures before you chase a single score on its own.
How do you find which elements shift on the page?
Use the Chrome DevTools Performance panel, which lists each shift, its score and the elements that moved.
- Open the page in Chrome, open DevTools, and select the Performance tab.
- Set CPU throttling to 4x slowdown to simulate a mobile device, as the Chrome DevTools guide recommends.
- Record a reload, then look at the Layout Shifts track, where purple bars mark each shift cluster.
- Click a shift to see an animation of the move and the details in the Summary panel.
The live metrics view in the same panel shows CLS while you scroll and click, so you can catch shifts that happen after load. Web.dev describes this view in its guide to optimizing CLS.
The Summary view lists the elements that shifted, and the Layout shift culprits insight in the Insights panel lists possible reasons. Start with the largest cluster, since it contributes the most to the score.
How do you fix images that cause layout shift?
Add width and height attributes to every image and video, so the browser reserves the right amount of space before the file loads.
- In the block editor, select each image and confirm its width and height are set in the block settings.
- For images added by hand in HTML or a widget, add the real dimensions, such as width=“640” height=“360”.
- Add CSS so the image still scales on small screens, as shown below.
img {
width: 100%;
height: auto;
}
- Keep the same aspect ratio across every copy in a srcset, so any size the browser picks fits the same space.
- Do not lazy-load the first large image on the page, and do not mark it with fetchpriority=“high” at the same time as loading=“lazy”.
The function returns loading=“lazy” for images outside the viewport, fetchpriority=“high” for the main in-viewport image, and decoding=“async” for every image.
Its developer reference states that for any resource, width and height must be provided to avoid layout shifts, and the function dates from WordPress 6.3, as of November 2026. The same reference page warns that no element should have both loading=“lazy” and fetchpriority=“high”.
| Cause | Fix | Where to apply it |
|---|---|---|
| Images without dimensions | Add width and height | Image block or HTML |
| Web fonts that swap late | Use font-display: optional and a matched fallback | Theme CSS or font settings |
| Ads and embeds | Reserve space with min-height or aspect-ratio | Ad slot or embed block |
| Banners and popups | Reserve space or use an overlay | Cookie or promo block |
| Animations | Use transform instead of top and left | Theme or builder CSS |
A caching plugin can help with the files around the fix, and our WP Rocket Core Web Vitals setup covers the settings that sit next to these image fixes.
How do you fix layout shift from web fonts?
Stop font swap shift by setting font-display: optional, picking a close fallback font, and preloading only the fonts the first screen needs.
Both the flash of unstyled text and the flash of invisible text can cause layout shifts. The text is laid out with the fallback font first, then re-laid out with the web font, as web.dev explains in its guide to optimizing CLS.
With font-display: optional, the web font is used only if it is ready by the time of first layout, which avoids a re-layout. The same guide lists this as the first tool for font shift, ahead of fallback matching and preloading.
Match the fallback font to the web font with size-adjust, ascent-override, descent-override and line-gap-override. These settings shrink the size gap between the two fonts, so the swap moves less text.
Use WOFF2 files only. WOFF2 compresses 30% better than WOFF, according to the web.dev font guide, so the font file is smaller and arrives sooner.
Preload only the main font file. Preloading takes browser resources away from other files, so preloading every weight and style slows the rest of the page. If your fonts load from a third party, add a preconnect hint for the font host as well.
- Set font-display: optional in each @font-face rule.
- Add a close fallback in every font-family list.
- Use WOFF2 files and drop older formats.
- Preload the main font file only.
- Preconnect to the font host when fonts load from a third party.
If your theme loads its fonts through a builder, check the builder settings too, as our Elementor performance settings guide explains.
How do you reserve space for ads, embeds and videos?
Reserve a fixed space for every ad, embed and video before it loads, using min-height or aspect-ratio on its container.
Ads are one of the largest contributors to layout shifts on the web. Ad slots often change size when the ad arrives, which pushes the content below them down the page, as web.dev notes in its guide to optimizing CLS.
For responsive ads, use the aspect-ratio CSS property or a min-height rule on the slot. Keep the placeholder in place even when no ad is served, since removing the reserved space causes as much shift as adding content.
Give video embeds and maps a container with a set aspect ratio, such as 16:9, so the frame has its space before it loads. Embeds often do not know their own size in advance, which is why the container must set it.
Place late-loading content lower on the page when you cannot reserve space. Content near the top of the viewport causes larger shifts than the same content placed further down.
Speed work and CLS work overlap, and our WordPress speed guide lists the wider steps in order.
How do you stop banners and popups from shifting the page?
Reserve space in advance for banners, cookie notices and popups, or show them as an overlay that sits above the page instead of pushing content down.
Banners that appear at the top of the page are a common cause of shift, because everything below them moves down when they load. Reserve the space with a placeholder or skeleton block, so the page layout is set before the banner arrives.
Shifts within 500 milliseconds of a click, tap or key press do not count toward CLS. A “Load more” button is safer than content that appears on its own, because the visitor started the change, as web.dev explains in its guide to optimizing CLS.
When you load more items, replace content inside a fixed-size container or let the user start the load. Disable links and controls until the change finishes, so no one taps a target that is still moving.
For live feeds, load the new content off screen and show a notice, such as a “Scroll to top” button, instead of pushing the page down while the visitor reads.
How do you fix layout shift from animations?
Animate with transform instead of top, left, height or width, because transform moves do not trigger a new layout.
Changing top, right, bottom or left causes layout shifts even when the element sits on its own layer. Using transform: translate() to move elements and transform: scale() to resize them avoids that problem, according to the web.dev CLS guide.
Use transform for menus, sliders and hover effects. Keep the motion short and smooth, so the move reads as motion rather than a jump.
Respect prefers-reduced-motion settings in the browser, since some visitors have trouble with animation. Web.dev notes this in the same guide, next to the advice to use transform.
How do you check that your CLS fix worked?
Re-test the same URLs in PageSpeed Insights and compare the field CLS before and after, then watch Search Console for the fix to reach real users.
- Re-run PageSpeed Insights on each fixed page and compare the lab CLS with the earlier run.
- Repeat the DevTools recording and compare the Layout Shifts track with the first trace.
- Check the Search Console Core Web Vitals report again after traffic has passed through the changed pages.
Field scores move only as real visitors load the fixed pages, so a single lab run is not proof. Fix the largest shifts first, because the score comes from the largest burst, not from every small move on the page.
Keep pages eligible for the back/forward cache, which restores a page exactly as the visitor left it. Going back then shows no repeat of the load shifts, as web.dev explains in its guide to optimizing CLS.
For the full picture, see how page speed affects SEO before you decide what to fix next.
What mistakes should you avoid?
The most common mistake is fixing one cause and ignoring the rest, since one large burst from any source can fail the whole page.
- Removing width and height to make images “responsive”. Use CSS with height: auto instead, so the image scales without losing its reserved space.
- Lazy-loading the hero image. The first large image should load at once, and WordPress warns against pairing loading=“lazy” with fetchpriority=“high” on the same image.
- Preloading every font weight and style. Preload the main font only, or the preloads crowd out the files the page needs first.
- Letting ad slots resize freely, or removing an empty ad slot. Keep the reserved space even when no ad is served.
- Animating menus and sliders with top or left. Use transform for every move.
- Judging the fix from one lab run. Lab tools measure the load only, while field data covers the whole visit.
- Adding new content above existing content without space. Put new blocks below the fold or behind a button the visitor presses.
Frequently asked questions
Can a WordPress plugin fix CLS for me?
A plugin can help with part of the job, such as adding image dimensions or preloading fonts, but it cannot reserve space for your ads, embeds and banners on its own. You still need to set sizes in your theme and blocks, and check the result in PageSpeed Insights. Treat a plugin as a helper, not a fix by itself.
Why is my CLS score different in PageSpeed Insights and Search Console?
PageSpeed Insights shows a lab score from a single load and a field score from real users, while Search Console groups real-user data across many visits. Lab tools usually measure only the page load, but field data covers the whole visit, including shifts after load. The two views answer different questions, so use both.
Does CLS affect my Google rankings?
Google recommends that site owners achieve good Core Web Vitals for success with Search, and lists CLS with loading and interactivity as the three metrics. Good scores alone will not lift a weak page, and a poor CLS score alone will not sink a strong one. Fix CLS because it improves the reading experience, not as a shortcut to rank.
Should I lazy-load all images to fix CLS?
No. Lazy loading defers when an image loads, but it does not reserve space for it, so an image without dimensions still shifts the page when it arrives. Never lazy-load the first large image on the page, since that image should load at once. Add width and height first, then let WordPress lazy-load the images further down.
How often should I re-check CLS after a fix?
Re-check each changed page in PageSpeed Insights right after the fix, then check the Search Console report again after real visitors have loaded the new version. Re-check whenever you change your theme, add a plugin, or change an ad slot, since each of those can add a new shift. A monthly check catches slow drift.
Sources
- Cumulative Layout Shift (CLS) web.dev
- Optimize Cumulative Layout Shift web.dev
- Best practices for fonts web.dev
- Understanding Core Web Vitals and Google search results Google Search Central
- wp_get_loading_optimization_attributes() WordPress Developer Resources
- Analyze runtime performance Chrome for Developers
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
