Liftup TechnologiesWhatsApp+91 77689 10234Get a free quote
Services

SEO and AI search

Websites and stores

AI and automation

Apps and more

WorkPricing
Resources

Learn

Plan and price

Company

AboutContact
Get a free quoteWhatsApp usCall +91 77689 10234

Web fonts: how they work and how to load them without text jumping

Fonts are small files with a large effect on how a page feels while it loads. This guide explains what the browser does, why text flashes or jumps, and the settings that fix it.

The short answer

Web fonts are font files a page downloads so text can appear in a typeface the visitor's device does not have. Text flashes or jumps because the fallback font and the web font differ while the file loads. Fix it with the font-display setting, WOFF2 files, subsetting, preloading only the fonts used above the fold, and a well-matched fallback.

What web fonts are

Web fonts are font files that a page downloads so text can appear in a typeface the visitor's device does not already have. Without them, a page can use only the fonts installed on each device, which differ between phones, laptops and operating systems. A web font lets you choose one typeface and have it appear the same way everywhere.

In the page's CSS, a rule called @font-face tells the browser the name you are giving the font and where to find the file. The browser then downloads the file when text on the page needs it. That download is the source of every problem in this guide: the page cannot show the final text in the right font until the file arrives, so the browser has to decide what to show in the meantime.

The format matters less than it used to. WOFF2 is supported by current browsers, so unless you must serve very old ones, use WOFF2 and skip the older formats. If you list more than one format, put WOFF2 first, because the browser picks the first one it supports.

What the browser does while a font loads

The sequence is the same on almost every page.

  1. The browser receives the HTML and starts reading it.
  2. It finds the CSS and works out which fonts the visible text needs.
  3. It requests those font files. They are not discovered until the CSS has been read, which is why they can arrive late.
  4. While waiting, it must either hide the text, show it in a fallback font, or wait for a short time and then pick one.
  5. When the file arrives, it may swap the text into the web font.

Two visible problems follow. In the first, text is invisible for a moment and then appears. In the second, text appears in a plain fallback font and then changes to the web font. Designers sometimes call these a flash of invisible text and a flash of unstyled text. Both are normal behaviour, controlled by one CSS setting.

The third problem is the jump. Even invisible text takes up space, laid out using the fallback font. When the real font arrives and has different letter widths or line heights, the text block resizes and everything below it moves. That movement is a layout shift, and it counts against your Cumulative Layout Shift score.

Choosing a font-display value

The font-display descriptor in the @font-face rule tells the browser how to behave while the file loads. Web.dev and MDN describe the main values like this; check their current documentation for exact timings.

ValueWhat the visitor seesGood forRisk
blockText can stay invisible for a few seconds, then appears in the web fontCases where the wrong font would look broken, such as a logo made of textSlow connections see nothing for a while
swapText appears at once in a fallback, then changes when the font arrivesHeadings and brand elements where the typeface mattersThe change late in loading can shift the layout
fallbackA very short invisible period, then fallback text, with a limited window to swapBody text where a quick, stable page matters mostSome visits end up with the fallback
optionalA very short invisible period, then the fallback is used if the font is lateBody text when speed and stability matter more than the exact typefaceSome first visits never show the web font, though later visits usually do

Web.dev calls optional the most performance-friendly choice, because there is no swap and so no layout shift from the swap itself. A common approach is to use swap for a distinctive heading font and optional or fallback for body text. Sources differ on whether to preload a font that uses optional, so test both on your own pages.

Making the swap hard to notice

Even with a good setting, the change from fallback to web font should not move the layout. The fix is to make the fallback behave like the real font. CSS lets you define an adjusted local font, using descriptors such as size-adjust, ascent-override, descent-override and line-gap-override, so the fallback has nearly the same width and line height as the web font. When the real font arrives, little changes. Free calculators can suggest the values for a given font. Support for these descriptors varies by browser and version, so ask your developer to check MDN's current compatibility tables.

Also finish every font stack with a generic family such as sans-serif or serif, so something sensible shows if every other option fails. Choose a web font with proportions close to the system font where you can; a typeface with unusually wide letters will always jump more.

How to load fonts faster

These steps cut the wait, roughly in order of payoff.

  • Download less. Subset the font to the characters you use and serve WOFF2. Subsetting matters most for languages with very large character sets such as Japanese, Chinese and Korean, where a full font can be many megabytes. The unicode-range setting makes the browser fetch a file only when the page contains characters from that range, which also helps sites that offer several scripts, such as Latin and Arabic.
  • Load fewer files. Every family, weight and italic is normally a separate file. A variable font packs a range of weights into one file, which can replace several static files, though the single file can be larger, so compare sizes.
  • Preload the fonts used in the first screen. A preload link tells the browser to start the download before it finds the font in the CSS. It needs the as attribute set to font, the type set to font/woff2 and the crossorigin attribute, or the browser ignores it. Preload only one or two fonts. Too many preloads compete with more important files.
  • Serve the files from your own domain or from a fast host. Self-hosting avoids an extra connection to another company, and some businesses prefer it for privacy reasons. If you serve visitors in regions with strict rules on third-party requests, ask a lawyer.

Fonts are discovered through CSS, so the lazy loading used for images and video does not apply to them. The guide to lazy loading explains what that technique does cover.

How many fonts can a site use?

There is no fixed limit. The practical limit is how many files the page downloads before the visitor sees text, and each one costs time. For most business sites, one or two families, each in two or three weights, is plenty. Treat the file count, not the family count, as the figure to watch.

What you addEffect
A second familyAt least one more file, often several
Another weight, such as bold or lightOne more file, unless you use a variable font
Italic stylesOne more file per weight you use in italic
Support for another script or languageMore files, or a larger subset
An icon fontOne more file; check whether inline images would be lighter

Do not load weights that no page uses. If the design needs bold only in two headings, check whether a regular weight there would do. Avoid fake bold, where the browser thickens a font that has no bold file, because it looks worse than the real thing. For a focused page that exists to convert one campaign, be strict: one family and two weights is a good limit, as the guide to landing page versus website explains for such pages.

Licences, briefs and developer handover

A licence for printing or for desktop software is not always a licence for a website. Web use may need its own licence, sometimes based on traffic, and the terms differ between suppliers. Read the licence, and ask the supplier if it is unclear.

Put your font decisions in the website brief for your developer: the typefaces, the weights, the languages and scripts you need, the fallback fonts, and the proof that you hold a web licence. A hosted font service works like an API, a connection to another company's system, so it helps to read what an API is before you depend on one. Decide what visitors should see if that service is slow or unavailable.

How to check fonts on your own site

Open your browser's developer tools and go to the Network tab. Filter by fonts and reload the page. Note how many font files load, how large each is and how late they start. Then use the throttling option to simulate a slow connection, reload and watch the text. If it flashes or jumps, try a different font-display value or adjust the fallback, and test again.

Finish with a speed test of the page. The guide to checking and improving website speed explains the tools and how to read the results. If you want help tuning font loading on an existing site, Liftup Technologies' website development service is one place to start.

Related guides

Questions and answers

What are web fonts?

They are font files a web page downloads so text can appear in a typeface the visitor's device does not already have. A rule in the page's CSS names the font and points to the file. They give you a consistent look, at the cost of extra downloads.

Why does text flash or jump when fonts load?

The browser must show something while the font file downloads. It either hides the text briefly or uses a fallback, and when the real font arrives the text can change shape and move the content below it. The font-display setting and a well-matched fallback reduce both effects.

How many fonts can a site use?

There is no fixed limit, but every family, weight and italic is usually a separate file. One or two families in a few weights is enough for most business sites. Count the files the page downloads and remove any that are not used.

Should I self-host my fonts?

Self-hosting avoids an extra connection to another company and gives you control over caching and privacy. A hosted service can be simpler to set up. Either works if the files are small and delivered quickly, and the licence allows the use.

What does font-display do?

It tells the browser how to behave while a font downloads: hide the text for a while, show a fallback and swap, or use the fallback if the font is late. Swap suits headings and optional suits body text where stability matters most. Test the values on your own pages.

Do web fonts affect SEO?

Google does not document font choice as a ranking signal. Fonts matter indirectly, because large or late fonts slow the page and can cause layout shifts, which feed into page experience measures. Keep them light and stable and you avoid the problem.

Get a free quote
Discuss on WhatsApp