Home / Fix guides / Speed and Core Web Vitals

How to fix font swap layout shift

Font swap layout shift happens when your page shows text in a backup font, then jumps when your real font arrives. Fix it by loading fewer fonts, loading the important ones sooner, and making the backup font take the same space.

Font swap layout shift happens when a page first shows text in a plain backup font, then replaces it with your brand font once that font has downloaded. If the two fonts differ in width or height, the text reflows and everything below it jumps. The fix is to make the swap invisible: load the font sooner, load less of it, and make the backup font take up the same room.

What people see

A visitor sees the headline appear in one font, then flicker into another. Lines wrap in a new place, and buttons or images slide down a few pixels. The worst case is a shift just as someone taps a link, so they hit the wrong thing.

Often this only happens on the first visit or on a slow mobile connection, because the font is cached afterwards. That is why many owners never notice it on their own computer.

Why it matters

  • Core Web Vitals: Google measures Cumulative Layout Shift (CLS). A score of 0.1 or lower counts as good. It is one page experience signal among many, not a magic ranking switch, but poor scores are worth fixing.
  • Trust: a page that jumps around looks unfinished, especially on a phone.
  • Sales: moving buttons cause mis-taps on menus, add to cart buttons and forms.

Font shifts are rarely the only cause of a high CLS score. If your score stays high after fixing fonts, see high CLS for the other usual suspects.

How to check your site for free

  1. PageSpeed Insights: enter your address and look at the CLS number and the layout shift items in the diagnostics. Wording changes over time. The top section (real visitor data) only appears if your site has enough traffic.
  2. Chrome DevTools: open the page, press F12, go to the Performance panel, set network throttling to a slow option, tick the option to disable cache in the Network panel, then record a reload. Layout shifts are marked on the timeline, and clicking one shows which element moved. If a heading or paragraph is listed, fonts are a likely cause.
  3. Highlight shifts: in DevTools, open the Rendering tab (from the three dot menu, More tools) and turn on Layout Shift Regions. Moved areas flash blue.
  4. Network panel: filter by Font and reload. Note how many font files load, how big they are and when they start.
  5. Search Console: the Core Web Vitals report groups slow or shifting pages for your whole site.

Test with the cache off and a slow connection. Otherwise the font is already on your computer and the problem hides.

How to fix it in general

1. Load fewer fonts. Every family, weight and style is usually a separate file. Use only what the design needs, prefer woff2 files, and cut character sets you do not use. See too many font files for details.

2. Self-host and preload the key fonts. Preload only the one or two fonts used at the top of the page, such as the heading and body regular weights:

<link rel="preload" href="/fonts/brand-regular.woff2" as="font" type="font/woff2" crossorigin>

The crossorigin attribute is needed for fonts even when they are on your own domain. Preloading too many files slows other things down.

3. Pick a sensible `font-display` value.

  • swap: shows the backup font at once, then swaps. Fast text, but causes a shift unless the fonts match.
  • optional: uses your font only if it arrives very quickly, otherwise keeps the backup for that page view. No shift, but some first-time visitors will not see your brand font on that first load.
  • fallback: a compromise with a short swap window.

4. Make the backup font match. Modern CSS lets you adjust a local font so it takes the same space as your web font:

@font-face {
  font-family: 'Brand Fallback';
  src: local('Arial');
  size-adjust: 105%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}
body { font-family: 'Brand', 'Brand Fallback', sans-serif; }

The percentages above are examples only. The right values depend on your font. Free font metric tools and calculators can work them out, and some frameworks do it for you.

5. Replace icon fonts if you can. Icons loaded as a font can appear late and shift buttons. Inline SVG icons avoid this.

Common platforms

Menu names differ between versions and themes, so look for the idea rather than the exact label.

  • WordPress: fonts are set by the theme, the Site Editor or a page builder. Look for an option to host fonts locally, a font display setting, or a font preload option in your theme or performance plugin. See the WordPress guide.
  • Shopify: most themes use fonts from the theme settings under typography. Themes decide how they are loaded, so a developer may need to check the theme code for font-display and preloading.
  • Next.js: the built-in next/font module self-hosts fonts and sets up an adjusted fallback font for you. Make sure you use it instead of a plain stylesheet link.
  • Webflow: check the fonts section in project settings. Custom fonts usually offer a font display option.
  • Elementor: look in Elementor's settings for how Google Fonts load, and in custom fonts for a font display option. It depends on your version.
  • React (without a framework): nothing is automatic. Add the preload link to your main HTML file and the fallback CSS to your stylesheet.
  • Squarespace: control is limited. The most reliable step is to use fewer fonts or choose ones with a similar fallback.

How to confirm the fix worked

  1. Repeat the throttled, cache-off test in DevTools and check that no heading or paragraph is listed as shifting.
  2. Run PageSpeed Insights again and compare the CLS number with your earlier one.
  3. Be patient with real visitor data. PageSpeed Insights and Search Console use data collected over about 28 days, so improvements show up gradually.
  4. Look at the page on a real phone over mobile data, not wifi.

How to stop it coming back

  • Retest whenever you change theme, font, heading size or page builder settings.
  • Keep a short list of approved fonts and weights, and say no to extra ones.
  • Check new pages that use different fonts, such as landing pages from a campaign.
  • Re-measure on a schedule. SiteMonday runs speed and Core Web Vitals checks in week 4, with a written report and a ranked fix list. The fixing itself stays with you or your developer.

Step by step for your platform

Questions

What is font swap layout shift?

It is the jump that happens when a page first shows text in a backup font and then replaces it with your web font. If the fonts differ in size, the text and the content below it move.

Does font-display: swap cause layout shift?

It can. It shows text immediately, which is good, but the later swap moves things if the backup font is a different size. Matching the fallback font or using optional avoids the jump.

Should I use font-display: optional?

It is the safest choice for avoiding shifts, as long as you accept that some first-time visitors will see the backup font on their first page view. Preloading your main font makes that less likely.

Is it better to host fonts myself than use Google Fonts?

Often yes, because it removes a separate connection and gives you control over preloading and fallbacks. You still need to limit weights and use woff2 files for the benefit.

Will fixing font shift improve my Google ranking?

Layout stability is part of Google's page experience signals, but it is only one factor among many. The clearer gain is a calmer page that visitors trust and can click without mis-taps.

Why can't I see the problem on my own computer?

Your browser has probably cached the font, so it appears instantly. Test with the cache disabled and network throttling turned on to see what a first-time mobile visitor sees.

Related problems