Web & Development

How to Optimize Web Fonts Without Slowing Down Your Website

How to Optimize Web Fonts Without Slowing Down Your Website

Custom fonts can improve a website's visual identity, but poorly configured font loading can delay text rendering and cause layout shifts. Learn how to identify unnecessary fonts, use WOFF2, configure font-display, preload essential files and verify the results in your browser.

A website can load quickly and still feel slow.

Sometimes, the page background appears, images begin to load, and the navigation is visible — but the text takes another moment to appear. On other websites, the text appears immediately, then suddenly changes font, causing headings and paragraphs to move.

The problem may be your web fonts.

Custom fonts are an important part of a website's identity. They help distinguish a brand, establish a visual hierarchy and make content more pleasant to read. But loading too many font files, or loading them at the wrong time, can affect the visitor's experience.

The good news is that you rarely need to abandon your preferred typography. A few changes to your CSS and HTML can make a noticeable difference.

This guide explains how to optimize web fonts on a real website, including WordPress and Joomla, without installing complicated tools or accessing your server through a command line.

1. Why web fonts can slow down a website

When a visitor opens a page, the browser downloads the HTML and CSS needed to display it.

If your CSS references a custom font, the browser may also need to download one or more font files before it can display the text in the intended typeface.

Consider a website using:

  • A regular font for paragraphs.
  • A bold font for headings.
  • A semibold font for navigation.
  • An italic font for quotations.
  • A separate decorative font for titles.

Depending on how the font family is packaged, that can mean five or more downloads.

And if the website loads multiple font families, the number can grow quickly.

There are two particularly visible problems.

Invisible text: The browser temporarily delays displaying text while waiting for the font. This is often called FOIT (Flash of Invisible Text).

Changing text: The browser first displays a fallback font, then replaces it with the custom font. This is known as FOUT (Flash of Unstyled Text). It is not necessarily a problem, but differences in character widths can cause visible movement.

The goal is not simply to download fonts faster. It is to make text readable as early as possible while minimizing unexpected changes to the layout.

2. Find out which fonts your website actually loads

Before changing anything, identify the files your website requests.

You can do this directly in Chrome, Edge or Firefox.

Step 1: Open the developer tools

Visit your website, right-click the page and select Inspect.

Open the Network tab.

Step 2: Reload the page

Enable Disable cache, if available, while the developer tools remain open.

Reload the page.

This makes it easier to see the resources downloaded during a first visit.

Step 3: Filter the requests

Select the Font filter.

You might see something like this:

File Purpose Example size
site-regular.woff2 Body text 38 KB
site-medium.woff2 Navigation 41 KB
site-semibold.woff2 Buttons 43 KB
site-bold.woff2 Headings 45 KB
decorative-font.woff2 Page titles 82 KB

Illustrative file sizes, not measurements from a particular website.

In this example, the website downloads approximately 249 KB of fonts.

That may not sound excessive, but it is worth checking whether every file is actually needed.

Step 4: Identify unnecessary requests

Ask yourself:

Does the website really need both medium and semibold?

Is the decorative font used anywhere on this page?

Are multiple font families being loaded by the theme and a page builder?

Does a plugin load an icon font even though the page uses only one or two icons?

The last two questions are particularly relevant to WordPress and Joomla websites, where themes, templates and extensions can each introduce their own font resources.

Do not remove a font just because its filename looks unfamiliar. First identify which element uses it.

3. Use WOFF2 instead of unnecessarily large font files

Modern websites should generally prefer WOFF2 for web font delivery.

WOFF2 is a compressed font format designed for the web. It is widely supported by modern browsers and typically produces smaller files than traditional TTF or OTF formats.

For example, a website might currently reference:

@font-face {
  font-family: 'SiteFont';
  src: url('/fonts/site-regular.ttf') format('truetype');
}

If you have a properly licensed WOFF2 version of the same font, you can use:

@font-face {
  font-family: 'SiteFont';
  src: url('/fonts/site-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}

The browser will download the WOFF2 file when that font face is needed.

Where can you obtain WOFF2 files?

Start with the font publisher or the font provider's official download package.

Some font families already include WOFF2 files.

If you need to convert a font, check its license first. Not every desktop font license permits conversion or web embedding.

Also make sure the converted file preserves the characters your website needs, especially accented letters and non-Latin alphabets.

Practical tip: For a multilingual website, test real translated pages rather than checking only the English homepage.

4. Configure font-display so visitors can read the text sooner

One of the simplest improvements is to configure the font-display descriptor.

It controls how the browser displays text while a custom font is loading.

A common configuration is:

@font-face {
  font-family: 'SiteFont';
  src: url('/fonts/site-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

With font-display: swap, the browser can show a fallback font almost immediately, then replace it with the custom font when it becomes available.

Illustration of the article's main concept

This is often a reasonable starting point for content-heavy websites.

However, swap is not automatically the best choice for every situation.

Choosing the right value

Value Behavior Typical use
swap Shows fallback text quickly, then swaps when the font loads Body text and general content
fallback Gives the custom font a limited opportunity to replace the fallback Sites prioritizing visual stability
optional May keep the fallback font for the current page view Nonessential decorative typography
block Can briefly hide text while waiting for the font Specialized cases where the font is essential
auto Leaves the strategy to the browser Default behavior

For a blog, documentation website or ecommerce store, I would begin by testing swap and fallback.

For decorative typography that is not essential to understanding the content, optional may also be worth evaluating.

Remember that displaying text immediately and avoiding layout shifts are related but different goals.

A font swap can still cause text to move.

5. Reduce layout shifts by choosing a better fallback font

Imagine that your custom font has relatively wide characters, but the fallback font is much narrower.

The browser initially displays a heading on one line:

Example product category

When the custom font arrives, the heading may need two lines instead.

Everything below it moves down.

That can contribute to Cumulative Layout Shift (CLS), one of Google's Core Web Vitals.

A simple improvement is to choose a fallback font with similar proportions.

For example:

body {
  font-family: 'SiteFont', Arial, sans-serif;
}

But there is a more precise option.

CSS supports font metric overrides, including size-adjust, ascent-override, descent-override and line-gap-override.

You can define a dedicated fallback font face:

@font-face {
  font-family: 'SiteFont Fallback';
  src: local('Arial');
  size-adjust: 102%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

body {
  font-family: 'SiteFont', 'SiteFont Fallback', sans-serif;
}

These percentages are illustrative only. They must be calculated or adjusted for the actual custom font and fallback combination.

Otherwise, you could make the layout less stable rather than more stable.

The practical approach is to begin with a sensible fallback, then compare the page before and after the custom font loads.

If headings or buttons move visibly, investigate the font metrics.

6. Preload only the fonts needed immediately

Normally, the browser discovers a font after processing the CSS that references it.

For a font used prominently above the fold, you can sometimes improve loading by telling the browser about it earlier.

Add this to the HTML <head>:

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

The crossorigin attribute is important even when the font is hosted on the same origin, because font requests use CORS handling.

Your CSS still needs the corresponding @font-face declaration:

@font-face {
  font-family: 'SiteFont';
  src: url('/fonts/site-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

Which fonts should you preload?

Usually, start with the regular font used for the main content or another font that is genuinely critical to the initial page display.

Do not preload every weight and style.

Preloading six font files can compete with other important resources, including the main image and critical CSS.

Also ensure the preloaded URL matches the font URL actually requested by CSS. A mismatch can result in unnecessary downloads.

After adding a preload, verify in the Network tab that the font is requested and reused as expected.

7. Use fewer font weights and consider variable fonts

Many websites load separate files for each weight:

site-regular.woff2
site-medium.woff2
site-semibold.woff2
site-bold.woff2

If the design does not genuinely need all four, removing one or two weights can reduce the number of resources.

Another possibility is a variable font.

A variable font can contain a range of weights in one file.

For example:

@font-face {
  font-family: 'SiteVariable';
  src: url('/fonts/site-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

You can then use:

body {
  font-family: 'SiteVariable', sans-serif;
  font-weight: 400;
}

h1,
h2 {
  font-weight: 700;
}

The browser can use the same variable font resource for both weights.

But a variable font is not always smaller than two carefully optimized static files.

Compare the actual file sizes and the weights used on your website before deciding.

8. Avoid loading characters your website never uses

Some font files contain thousands of glyphs.

If your website uses only a limited character set, a smaller font subset may be sufficient.

CSS supports unicode-range in @font-face declarations.

For example:

@font-face {
  font-family: 'SiteFont';
  src: url('/fonts/site-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF;
}

This range covers the basic Latin-1 block, including many Western European accented characters.

However, it does not cover every character used in every European language.

For multilingual websites, a better strategy may be to provide separate subsets for Latin, extended Latin, Cyrillic and other writing systems, using accurate ranges generated for each font file.

Technical workflow illustration

The browser can then download the subsets needed to display the page.

Important: Do not create a Latin-only font subset for a website that also publishes Japanese, Korean or Russian content unless suitable font files and fallback fonts are provided for those languages.

Otherwise, some characters may display in an unexpected typeface.

9. Optimize fonts in WordPress and Joomla

You do not necessarily need to edit theme or template files.

WordPress

Start with your active theme's typography settings.

  1. Open the theme or site editor, depending on your theme.
  2. Identify the font families and weights configured for headings and body text.
  3. Remove unnecessary font variants where the interface allows it.
  4. Check whether a page builder or another plugin loads additional fonts.
  5. Test the public page using your browser's Network tab.

If you use a performance plugin, review its font optimization settings carefully.

Some plugins can host Google Fonts locally, preload font files or adjust font loading behavior. The exact options depend on the plugin and its version.

Avoid enabling overlapping font optimization features in several plugins at once.

Joomla

For Joomla, the starting point is your active template.

  1. Open the template's style settings.
  2. Identify the fonts selected for the website.
  3. Check whether your template framework or page builder loads additional font families.
  4. Review the template's custom CSS facilities, if available.
  5. Make one change at a time and verify the public page.

If the template supports custom CSS, you may be able to define or override font loading without modifying the original template files.

Be careful with duplicate @font-face declarations and competing font settings.

A template update should not overwrite your customizations.

What about Google Fonts?

Google Fonts can be convenient, but it is worth checking how the fonts are requested.

A theme may load an entire family with multiple weights when the design uses only two.

Whether you use externally hosted or locally hosted fonts, the same principles apply: request only what you need, configure loading appropriately and measure the result.

Local hosting is not automatically faster in every configuration.

10. Measure the result with PageSpeed Insights and your browser

Optimization is only useful if it improves the actual experience.

Use two complementary tools.

Google PageSpeed Insights

Open PageSpeed Insights.

Enter the URL of the page you want to test.

Review the mobile results and inspect recommendations related to font display, network requests and layout shifts.

Pay particular attention to:

Largest Contentful Paint (LCP): How quickly the main visible content appears.

Cumulative Layout Shift (CLS): How much visible content unexpectedly moves.

First Contentful Paint (FCP): When the browser first displays content.

A font optimization can improve one metric while affecting another.

For example, displaying a fallback font earlier may improve the perceived loading experience but still produce a layout shift when the custom font arrives.

Browser developer tools

Repeat the Network test from the beginning of this guide.

Compare the number of font requests, total transferred size and loading order.

Then use network throttling to simulate a slower connection.

Observe whether text remains readable and whether the layout moves when fonts finish loading.

For a meaningful comparison, test the same URL under similar conditions before and after your changes.

11. Troubleshooting common web font problems

Problem Likely cause What to check
Text is invisible at first Font loading strategy Review font-display
Text moves when the font loads Different fallback metrics Compare fallback fonts and metric overrides
Font downloads twice Preload mismatch or different request settings Check URLs, crossorigin and Network requests
Custom font never appears Incorrect path, failed request or invalid font Inspect Network and browser Console
Some characters use another font Missing glyphs or incomplete subsets Check language coverage and unicode-range
Too many font files Unnecessary weights or multiple extensions Audit theme, template and plugins
Font optimization has no measurable effect Fonts were not the bottleneck Review images, CSS and other critical resources

A useful troubleshooting habit is to change only one variable at a time.

For example, first remove unused font weights. Measure again. Then test font-display. Measure again.

This makes it easier to understand which change helped.

12. A practical optimization example

Let's imagine a small business website using a custom font for everything.

Its initial configuration downloads four font files:

Before optimization Example transferred size
Regular 48 KB
Medium 49 KB
Semibold 51 KB
Bold 52 KB
Total 200 KB

After reviewing the design, the site owner discovers that medium and semibold are not necessary.

They keep regular and bold, use WOFF2, configure font-display: swap, and preload only the regular font used in the initial viewport.

The resulting files might look like this:

After optimization Example transferred size
Regular WOFF2 28 KB
Bold WOFF2 30 KB
Total 58 KB

These figures are hypothetical and illustrate the method. Actual savings depend on the font family, character coverage and file compression.

The number of font requests has dropped from four to two, and the total transferred size is lower.

But the most important step is still to test the page.

If the fallback font causes a noticeable layout shift, the next task is to improve the fallback configuration rather than declaring the optimization finished.

Conclusion: Optimize the fonts you use, not every font you can find

Web font optimization does not need to be complicated.

Begin by identifying which fonts your website loads. Remove unnecessary weights, prefer suitable WOFF2 files, configure font-display, and preload only resources that are important to the initial display.

Then check what visitors actually experience.

A good result is not simply a smaller font file. It is a website where text appears quickly, remains readable and does not jump around while the page loads.

For most WordPress and Joomla websites, those improvements can be made through template settings, theme options and a small amount of CSS — without introducing another heavy optimization system.