Web Development

Web Fonts: Loading Them Without Slowing Down Your Site

Web Fonts: Loading Them Without Slowing Down Your Site

Typography is one of the first things a visitor notices on a website, but the way fonts load is often the invisible culprit behind slow page loads and annoying text flicker. A web font is an extra resource the browser has to download before it can render it, and if that process is not controlled, the user stares at empty space or sees the layout jump when the real font finally appears. In this article we explain how fonts affect performance and which techniques we use to make text readable immediately, without sacrificing speed.

Why do fonts slow down a website?

Unlike images, which load in parallel and do not block the rest of the page, fonts have a special life cycle. The browser first has to load and parse the CSS, then discover which fonts are needed, and only then start downloading them. That means the font request happens relatively late in the rendering process.

Until the font is available, the browser makes a decision: either hide the text until the font arrives, or show a fallback system font and swap it later. The first option creates the so-called FOIT effect (flash of invisible text), and the second the FOUT effect (flash of unstyled text). Both hurt the experience, and they especially affect the Largest Contentful Paint metric, which is part of Google’s Core Web Vitals assessment.

Rule number one: control font-display

The CSS property font-display is the simplest tool for managing how a font behaves while loading. It is defined inside the @font-face rule and tells the browser what to do while the font is not ready yet.

  • swap: shows the fallback font immediately, then swaps it when the real font arrives. Text is always visible, but there may be a visual shift.
  • optional: gives the font a very short window to load; if it does not arrive in time, the system font is used and the real font is not swapped in later. Ideal for slower connections.
  • fallback: a compromise between swap and optional, with a slightly longer waiting period.

For most projects we recommend swap or optional, because both ensure the user never stares at a blank screen. Avoid the browser’s default behavior, which can hide text for up to three seconds.

Host your fonts yourself

Loading fonts from external services looks convenient, but every additional domain means a new DNS lookup, a new connection setup and extra latency. Self-hosting fonts on your own server or CDN eliminates that cost and gives you full control over caching and formats.

Self-hosting also solves the privacy issue, since visitor data does not go to a third party. When you serve fonts from the same domain as the rest of the site, the browser can reuse the connection it has already established, which significantly speeds up the download. This is standard practice on every serious project we deliver as part of our website development work.

If you are thinking about a new or better website for your company, see how we approach website development for clients in Sarajevo and across Bosnia and Herzegovina.

Use preload for key fonts

Since the browser discovers fonts only after parsing the CSS, we can signal earlier that certain fonts are important. This is done with preload in the document head:

  • Apply preload only to fonts that are visible right away, above the fold, usually the main font for headings and body text.
  • Do not preload every style and weight, because you will clog the bandwidth and slow down other important resources.
  • Always include the crossorigin attribute, because fonts are loaded in anonymous mode; otherwise the resource is downloaded twice.

Preload moves the font download to the very start of page loading, which dramatically reduces the time until text first renders correctly.

Reduce file size: subsets and modern formats

Much of the delay comes from the size of the font file itself. A standard font contains hundreds of characters your site will never use. By creating a subset, you keep only the characters you need, for example the Latin alphabet with the Bosnian diacritics č, ć, ž, š and đ, and drop Cyrillic, Greek or rare symbols.

The file format matters just as much. The modern WOFF2 format offers the best compression and is supported in all current browsers, so it should be your primary choice.

Format Compression Recommendation
WOFF2 Excellent Primary format for all projects
WOFF Good Only for very old browsers
TTF/OTF Poor Avoid on the web

Combining a subset with the WOFF2 format often cuts font size by more than half, which directly speeds up loading.

Prevent layout shift

When the fallback font is replaced by the real one, differences in letter width and height can push all the content down. That shift hurts the Cumulative Layout Shift metric and makes the page feel messy. The solution is to match the fallback font to the real one using the CSS properties size-adjust, ascent-override and descent-override.

These properties let the system font that displays first take up roughly the same space as the real font. When the real font arrives, the transition is almost unnoticeable, with no sudden jump in the text. This is the kind of detail that separates fast, polished websites from those that feel unfinished.

A practical checklist

  1. Limit the number of fonts and weights to what is actually in use.
  2. Host fonts on your own domain or CDN.
  3. Set font-display: swap or optional.
  4. Apply preload only to fonts visible above the fold.
  5. Serve fonts in WOFF2 format with a custom character subset.
  6. Match the fallback font to prevent layout shift.

Font optimization is not cosmetic but an engineering task that directly affects speed, readability and your position in search results. If you want your website to load text instantly and without flicker, take a look at our services or get in touch so we can analyze your project’s current performance together.

Related articles

More in Web Development
Quote in 24 hours

Need help with your website or online store?

Briefly describe what you need. We send a quote within 24 hours, with no obligation.

  • Reply within 24 hours
  • 30 days of support after launch
  • Everything is yours: code, design and domain
Either one is enough.

No obligation. We reply within 24 hours.

Protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.