Jun 22, 2018

Ultimate guide for web fonts load optimization

Custom web fonts allow you to make the website unique, emphasize its design and attract the attention of users. But the pay for these benefits is a long download site, which uses its own (custom) fonts. Especially if they are located on a remote host. What to do about it?

Below we will consider the main approaches to optimizing the web fonts: hosted hosting, Google API, the use of techniques for reducing the size and delayed loading of fonts.

Briefly, the optimization instruction looks like this:

  1. We collect the necessary set of fonts (leaving only the most necessary).
  2. We host it on a hosting or use the Google Fonts API.
  3. Configure caching and compression for font files.
  4. Set up delayed rendering and use localStorage.

A Brief History of Web Typography

It all began in 1995, when Netscape added support for the font tag and the ability to stylize the text of pages using a system font. This allowed using about 10 different fonts in all browsers. In 1997, Internet Explorer added support for the downloadable font in EOT format (which was rejected by all), this initiated the use of @ font-face as we know it now.

For the next 10 years, standards developers have focused on more global things, so ordinary webmasters had to "invent bicycles." The most common technique of "special" fonts on the pages of the site was the substitution of images, FLIR, (yes, hundreds of images were created with the "glyphs" of the designer font used to style the headers), Cufon (when JavaScript and vector graphics in SVG + VML) and sIFR on Flash. The latter approach worked in most browsers of that time, because Flash support was very wide (up to 98% in the best years).

In 2006, CTO Opera, Hakon Wium, launched a whole campaign against the use of the EOT format for web fonts, as Microsoft finished supporting the development of this format in 2002. As a result, support for alternative, typographic formats, TTF and OTF was added to most browsers, and by 2009 the use of font-face was practically approved in the current version: many different formats for different browsers.

The last milestone in 2010 was the appearance of the WOFF format, Web Open Font Format, which was able to collect the best of TTF and OTF, including out-of-box compression and additional meta-data, and the launch of the Google Fonts service, which became the de facto standard for connect non-standard fonts.

Why are web fonts so slow?

After the war of formats (WOFF is supported by 94% of all browsers), web fonts started the war for speed. During the development of the format, it was possible to agree on the connection of different font files for different browsers according to their support for these formats: this already solved a significant part of the problems (for comparison, one can recall the recent times when all possible styles for all browsers were written to the style file do not upload them as separate files).

But this did not solve the main performance problem: downloading fonts significantly blocked the rendering of the site pages, and with a large number of different fonts the site was terribly slow. There are several reasons for this:

  • Large size of font files: one non-standard font "weighs" like all site styles (font - binary vector data of a set of letters, glyphs, and styles are plain text, CSS code). Several non-standard fonts of several types already significantly block the rendering of the pages of the site.
  • Blocking page rendering: text on a website for which a non-standard font is assigned can be displayed only after downloading this font in the browser (after all it can be icons or bar codes). Because of this in most cases, the user sees a white screen in the browser until the necessary fonts have loaded (and they can be very large).

Using fonts

Custom web fonts, most likely, are absent in the user's browser. Therefore, you need to specify additional files to upload, which will contain technical information on the font design (characters - glyphs, features of the common drawing of characters and lines and other data). As it often happens, each browser needs its own file - Google Chrome understands the format of woff and woff2 (the most advanced), the old Android understands only TTF, and IE - eot.

Additionally, you can take into account that in rare cases the font can already be installed on the user's device: in this case you can use the local directive. The detailed CSS instruction that connects the corresponding font on the site will look something like this (we use different formats for "hitting" in different browsers):

@ font-face {
font-family: 'Awesome Font';
font-style: normal;
font-weight: 400;
src: local ('Awesome Font'),
url ('/fonts/awesome.woff2') format ('woff2'),
url ('/fonts/awesome.woff') format ('woff'),
url ('/fonts/awesome.ttf') format ('ttf'),
url ('/fonts/awesome.eot') format ('eot');

In this case, all font files are hosted. To support all browsers, you usually use a set of font files for each font (headset). It can be created, for example, via Font Squirrel: the service will automatically provide the CSS-code and a set of files for placement on the server.

Alternatively, you can use the Google Fonts service: you insert a service script call to the site, and depending on the browser you are using, the service already gives the appropriate CSS code and font files (already split into languages), supporting more than 30 different combinations.

But the main problem with downloading your own fonts is not solved: the fonts are large. Sometimes it's too big. And almost always they are required to display the text on the page (ie the font download is at the "white screen" stage, annoying users as much as possible). How can this be cured?

Google Fonts API

The first and most important step in optimization is to leave only the necessary fonts. Inventory of fonts (removal of unused sites or maximum trimming used in actually used symbols). Also you need to select not only fonts, but also their variants (usual, italic, bold).

The Google Fonts API allows you to download only the desired font options, and also loads fonts by character sets (allows browsers not to load the full font, if not all the glyphs are required to display the page). Among the additional features is the text = {letters} parameter, which cuts characters in the downloaded font strictly to the specified ones (if the font is used only for the logo, this can be very valuable).

Optimizing font size

Optimizing the font size consists of three basic things: to provide backwards compatibility, enable compression and eliminate unused glyphs. Before the optimization, you need to revise the set of non-standard fonts used and leave only those that are really needed for the site.

  1. Backward compatibility. To maximize the speed of displaying your site's text on any user device, you need to tell the browser which spare font family can be used if your own font is not available (not loaded yet or an unsupported format is loaded). To do this, in the font-face directive, after the name of your font, you need to specify the most suitable system alternative with a mandatory ending serif (serif font), sans-serif (without serifs) or monospace (equal width). Although backward compatibility leads to FOUT, but this alternative is better than the invisible text on the site (FOIT).
  2. Compressing fonts. If you use static compression, then it is enough to prepare archives with font files and place them next to the font files. With dynamic compression, check that all the main font formats - EOT, TTF, OTF, SVG, WOFF and WOFF2 - are given from the hosted compressed (compression test). If this is not the case, you need to add the required extensions or file types to the compression rules. Gzip (or zopfli) compression allows you to reduce the font size by 15-50%.
  3. Remove glyphs. To display text on a site, not all the characters included in the default font are usually required. Some of them refer to another language (for example, to Chinese), some to special symbols that you do not use. There are a lot of tools for removing from fonts unused glyphs and Windows/Mac utilities. The most popular ones are Font Squirrel (in Advanced mode), as well as Subset.py and FontPrep. Also, Google Fonts allows you to load only the used character sets. This optimization method allows you to reduce the resulting file by another 10-50%.

Together, all three methods allow you to significantly speed up the display of the site on all devices, regardless of the beauty of the used fonts and are well automated: for example, Airee Cloud uses the second and third optimization methods, reducing the size of hosting fonts by 20-80%.

Delayed loading of fonts

There are several approaches that allow you to apply some "magic" to web fonts load to minimize the negative effects.

The first is hard caching files (for ordinary users) and base64-representations (in localStorage, for mobile users). Reception works only for users who returned to the site, but for them it allows to significantly reduce download time (Detailed instruction on using localStorage).

The second is to use the Font Loading API (not supported by all browsers). When the page is initially loaded, you can display the text in the font specified by the user, load the required font asynchronously, and spend several tens of milliseconds (almost invisible "hang" of the browser) on redrawing the page as the font is ready. There are libraries for the automation of the process, one of them is presented here.

And the third one is prefetching fonts (if they are not used from the first page of users: for example, in a personal account). To do this, the prefetch technique, which is already very well supported by browsers, is suitabl: http://caniuse.com/#feat=link-rel-prefetch).

For a deeper immersion in the topic, we recommend reading the article from Google on the topic of font optimization.

Speed ​​up the loading of fonts

Web developers have introduced several abbreviations describing the situation when downloading fonts on the site. This is FOIT (Flash of Invisible Text) - invisible text on the page due to the lack of font in the browser to display it (in some cases it reduces to the appearance of squares in place of the icons), FOUT (Flash of Unstyled Text) - drawing the text in the wrong (spare) headset because of the lack of font and FOFT (Flash of Faux Text) - drawing text in a fake headset (false-inclined and pseudo-bold), based on the usual font style in the absence of special traces.

The mechanisms for working with the order of loading fonts in the browser are already well described, so we'll give the final schema:

We will analyze the final versions of this scheme with some applied improvements.

Practical recommendations

To avoid FOIT on the page, minimize the time FOUT or FOFT, you must apply the following measures to download font files:

  1. Add to all non-iconic definitions spare options that best match the desired headset. To date, in addition to a large set of "standard" fonts, browsers also support generic serif (serif), sans-serif (serif), monospace (monospace), cursive (handwriting), fantasy (decorative). Each headset assignment in CSS (via font* rules) must end with one of them. For example:
    font-family: "Avenir Next Cyr", Tahoma, sans-serif;
  2. Add to the directive for @ font-face the instant text display rule with a spare font option (this is suitable for non-iconic fonts):
    fon\t-display: swap
  3. The best technique for the fastest download of a font file in the browser is the preload tag, which makes it possible to ensure that the font files are ready by the time the page is rendered (after loading the styles and blocking scripts). It is supported by 68% of browsers (https://caniuse.com/#search=preload). For example:
    <link rel="preload" as="font" href="/assets/fonts/AvenirNextCyr-BoldItalic.woff" type="font/woff" crossorigin>
  4. To emulate preload in the remaining 30% of browsers and more stringent font caching via localStorage, you can preload the font via XHR. The script, if inserted at the top of the page, in the head, allows you to call the necessary font files and caches them in localStorage. Prefont files (style rules) must be converted to base64 for caching in localStorage (binary data can not be used). With this approach, you need to wrap the preload tags in <noscript> to avoid double loading the font.
  5. To eliminate FOIT for icon fonts, you can use Font Face Observer and optionally enter a CSS class for the downloaded font, initializing the font-face rule and assigning it to html or body. In this case, without a font in the browser, the squares will not be drawn instead of the icons, and immediately after the font is loaded, the icons will appear on the page.
  6. To reduce FOUT time when loading all the headset inscriptions (normal-bold, normal-inclined, bold-oblique, etc.), you can use FOFT and set the main font to the only one in normal outline in another font-family: in the LatoInitial example. After verifying the loading of all other traces (it is possible in asynchronous mode), Font Face Observer uses classes that correct false font faces for correct ones.

The question of using FOFT to accelerate the display of text is debatable (in many cases it is easier to rely on spare fonts), but can help you in a number of content projects.


  1. Some popular web fonts are-
    1. Arial
    2. Roboto
    3. Times New Roman
    4. Courier
    5. Verdana
    6. Georgia
    7. Palatino
    8. Garamond
    9. Bookman

    Thanks all ~ Charlotte W. from secure sdlc training

    1. The script, if inserted at the top of the page, in the head, allows you to call the necessary font files and caches them in localStorage. www.bathroomremodeltacoma.com/

  2. Spot lets start on this write-up, I truly think this fabulous website requirements considerably more consideration. I’ll apt to be again to see additional, thank you for that information. website design la

  3. This has to be one of my favorite posts! And on top of thats its also very helpful topic for newbies. nice one a lot for the information! los angeles web design

  4. I appreciate your work , thanks for all the informative blog posts. top web design companies

    1. Basically, it all refers to the usage of fonts on WWW. You can also download hundreds of fonts from the internet, just like my developer use on nursing dissertations UK and on different pages.

  5. I want to learn type but on my own for hire an animation studio . Does anyone know a good book that has everything about typography

  6. Excellent to be visiting your blog again, it has been months for me. Rightly, this article that I've been served for therefore long. I want this article to finish my assignment within the faculty, and it has the same topic together with your article. Thanks for the ton of valuable help, nice share. dotcomsecrets

  7. All members are advised to wait sometimes meanwhile read about other investment plans like NPS, LIC pension scheme with 9% return also open a ppf account with 500 to 150000 tax-free contribution for annum. NPS Account Registration

  8. First of all the procedure for requesting certified RoR, Plot Info Request, and Plot Map is the same. Only you have to fill different land details in the request form.

  9. Such an informative article for me keep share with us more such article i really appreciate you for this Visit Website

  10. fter uploading, all images will automatically be compressed by this tool. stucco repair denver

  11. I really appreciate this wonderful post that you have provided for us. Many thanks!
    Reference: ProWeb365 web design

  12. Very informative post! I guess it will optimize the site speed. stucco patch denver

  13. This comment has been removed by the author.

  14. This comment has been removed by the author.

  15. This comment has been removed by the author.

  16. I needed to thank you for this incredible read! I like each and every piece of it. I have bookmarked your site to look at the new stuff you post.read more

  17. Your article provides excellent erudition; thank you for taking the time to share such a nice article with us. Amazing insight you have on this, and it's nice to find a website that provides so much information about various artists. do my homework

  18. Reading your essay is a lot of joy. It's both educational and beneficial. I usually don't leave comments on blogs, but yours is so fascinating that I can't help myself. Keep up the wonderful work; I get everything from assignment help, and you're doing an excellent job.

  19. Excellent to be visiting your blog again, it has been months for me. Rightly, this article that I've been served for therefore long. I want this article to finish my Buy Essays Online UK within the faculty, and it has the same topic together with your article

  20. Economics Assignment Help - Economics is a discipline in social sciences that focuses primarily on the many factors determining the creation, distribution, organization and consumption of commodities and services. This is a popular topic among students; thus, a massive number of student’s worldwide study it. Generally, the universities provide pupils with a lot of economic tasks. Everyone wants to get excellent grades on their assignment in this highly competitive environment but taking marks from instructors is not an easy task that demands you to be diligent and proactive in studying and analysing your topic.

  21. I loved your blog. Its really very informative i will write a novel on that and then publish it on Online Novel writing Services

  22. There are different types of typograpgy with unique fonts. I want this article to finish my hnc assignment writing help within the faculty, and it has the same topic together with your article. Thanks for the valuable help information.

  23. This is nice. It is not that difficult after all.

  24. Thank you so much for sharing this information about web fonts!

  25. Nice presentation. When the page is initially loaded, you can display the text in the font specified by the user, load the required font asynchronously, and spend several tens of milliseconds (almost invisible "hang" of the browser) on redrawing the page as the font is ready.

    Best regards.
    Joana | Commercial drywall company

  26. you are interested in generating new, stylish, beautiful names for your family and loved ones. Here is the ultimate solution for you to bring the best tool in business. This word combiner is the most latest and well-thought tool for deciding the combinations that work perfectly for you and your family. It is commonly known as the name picker ninja.

  27. Our assistance with thesis help does not end there. Graduates, undergraduates, and high school students can all benefit from our assistance with their assignments. We can help students at all academic levels and with a wide range of essay formats, including lab reports, scientific case studies, and mathematical computations. Our top-rated thesis helpers can assist you with any academic issue you may be experiencing. Contact us immediately to see how our dependable writers can assist you in achieving your academic goals, no matter where you are on the academic route. You might even discover that your master's degree qualifies you for a position as a new recruit at your ideal firm.

  28. Web fonts are the main factor for any website so it's a good post if you are looking for website making and custom essay writing.

  29. I am searching for the best web fonts loads and how to execute them without compromising quality and speed. I guess, I will get help from your this post. My professor gave me an assignment on web fonts loads and now I can complete it by reading your provided information. I feel that I can now complete my assignment papers easily without getting help from professional writers earlier I was thinking to buy assignment online.
    Buy Assignments Online


  30. site that helps young / news save money and be more frugal in their day to day living. There’s also a section on their that shows how to make a little more cash on top of their monthly day job wage, which is vital in some cases just to keep your head above water. https://www.reparaciontejadoslasrozas.com/derribos-y-reformas

  31. Talk to us now on how we can answer your life's questions. We are your clairvoyance firm in Nice voyante

  32. Really appreciate you sharing this article. Thanks Again. Really Great.

  33. Digital Marketing Institute in KPHB

    Emblix Academy – Digital marketing institute in KPHB, we address all major and minor aspects required for any student’s advancement in digital marketing. Clutch USA named our Digital Marketing Institute the best SEO firm. Digital marketing institute in KPHB

  34. As it is already discussed that medical institutions gives numerous amount of assignments to the students in order assess the performance and responsiveness. To measure this the institution also provides assignment to the nursing candidates, the assignment help that is provided to nursing candidates ensures to meet every expectations of the clients and also provide them with reliable informations backed with examples and in hand experiences to validate the thesis paper. The purpose of this Nursing Assignment Help is to assist the candidates in the assignment in every way possible.

  35. before reading your blogs I did not know the how much benefits of Web Typography thanks for sharing philosophy dissertation writers

  36. Fare N Flights is best best travel agency in delhi for international tours which helps you book a vacation; We want to be your travel partner who will go the extra mile to help you choose the perfect destination and learn more about the place you've been dreaming of visiting. Since vacations are all about personal choices and interests, we also offer you customizable tour packages. We give you the right to pick and choose anything that matches your interests. No matter how many travel experiences we sell each day, we guarantee that you're the hero of your travel story.

  37. Thanks for sharing this great site! about

  38. Search for an organization that has been conveying hosting administrations for over 10 years and has the executives set up to deal with an extending client base productively.https://onohosting.com/

  39. Web fonts truly have an impact on the site's speed and performances: here's how to optimize and rightly use them. https://www.overlandparkjunkremovalpros.com/

  40. Generally speaking, using the preload resource hint to load fonts should be avoided. contact us

  41. This is really nice that you have this! landscape

  42. veterinarian services near me This will help me to create more fascinating websites, thanks for this

  43. tennessee veterinary clinic thanks for the tips, really want to learn this stuffs

  44. Previous studies have proven that small modifications in Readability Features (size, character spacing and width, and line spacing) have an immediate impact on reading performance. This study varies only font to understand the effect of base font alone. roofing contractors

  45. The social media marketing services industry has boomed in recent years, with more and more businesses turning to social media to reach their target audiences. However, with so many social media marketing companies out there, it can be difficult to know which one to choose. Best social media marketing services

  46. Useful to me, you can learn how to better optimize the delivery of your fonts in this comprehensive, hands-on guide

    URL: https://treeremovalmelbournearborists.com/

  47. can you give dogs aspirin Thanks for sharing this awesome tips on web optimization.

  48. Jili Slot เป็นผู้ให้บริการเกมคาสิโนออนไลน์และก็สล็อตออนไลน์ มีเกมสนุกสนานๆให้เลือกเล่นมาก สามารถเข้าไปเล่น jili slot เล่นผ่านเว็บไซต์ของพวกเราได้เลย ที่เว็บไซต์ pgslot

  49. pg ยอดเยี่ยมเกมออนไลน์สล็อตบนมือถือแบบใหม่ปัจจุบันของโลกสมัครเล่น PG SLOT วันนี้ไม่มีเบื่อไม่ซ้ำซากในแบบการเล่นเดิมๆอีกต่อไปเป็นเกมสล็อตที่แจ๊คพอตแตกหลายครั้งที่สุดลองเลย

  50. Wow, can this help with page loads? Like can it improve page speed of a certain website if font is optimize this way? Anyway, get the best tile and grout cleaning in Tempe from a trusted company like https://www.tileandgroutcleaningprostempe.com.

  51. This comment has been removed by the author.

  52. This guide is very helpful for me as I have to use many types of fonts when I am working on my PC. This method has solved the problem that I was facing. Thanks for sharing this with us. I really appreciate that. Now it's time to avail Telemarketing Services for more information.