Typography has interested me since I started developing websites and getting into design, even before there was widespread use of web fonts.
And although web fonts have been around for many years, we’ve always had to balance between the number of fonts we wanted to use versus the amount of information visitors to the site had to download because of them.
While typographic hierarchy and proper typography have great value in design for readability and a good user experience, on the web, using too many fonts will result in performance issues and therefore a negative user experience.
However, a few years ago an evolution of OpenType Fonts, the format we had used for many years, was introduced to the world. These fonts are called Variable Fonts, and besides saving bandwidth, they also provide numerous variations and interesting options.
OpenType Font Variations – (Variable Fonts)
Traditionally, when we loaded fonts on a site, we had to install different files for each width, weight, or variant we wanted to use. Bold weight in one file, light in another, condensed in yet another file, and so on, while installing a whole font family could (on desktop) reach 50 files or more.
A variable font is an evolution of OpenType that can hold many weights or variations in one file very efficiently. The font creator can decide which “axes” to include in the font and set minimum and maximum settings for them.
From a web and internet site perspective, it basically means that we can load a single file and use CSS to change those axes according to the range allowed by the font creator.
There are five standard axes (registered axes) that are commonly used: width, weight, slant, italic, & optical size. But the format can be expanded so that “custom” axes can be defined, allowing for many more variations.
Variable fonts aren’t only for the web. Design apps such as Illustrator, InDesign, Photoshop, and Sketch support them too.
Before we continue, play around a bit with the standard axes of the parametric font called Gimlet Variable:
-
Variable Fonts
| Design: | David Jonathan Ross |
|---|---|
| Publisher: | DJR |
| Characters: | Latin |
| Release: | 2020-01-01 |
| Licensing: | Paid/commercial |
How to Use Variable Fonts?
You can load a variable font from Google Fonts, or store those variable fonts locally for more control over performance and caching.
To host a font yourself, start by defining font-face rules pointing to the font files. One rule is enough for every weight in the file.
Here we load the variable version of Source Sans 3 and declare the weight range it supports:
@font-face {
font-family: 'Source Sans 3';
src: url('/path/to/SourceSans3-Variable.woff2') format('woff2');
font-weight: 200 900;
font-style: normal;
font-display: swap;
}
Keep a single src descriptor in the rule. A second one replaces the first, as MDN explains:
“If multiple
srcdescriptors are set, only the last declared rule that is able to load a resource is applied.” (MDN, @font-face src)
Now we can use the font with standard CSS rules, picking any weight inside the declared range:
h1 {
font-family: 'Source Sans 3', sans-serif;
font-weight: 850;
}
p {
font-family: 'Source Sans 3', sans-serif;
font-weight: 380;
}
The font-weight descriptor accepts values from 1 to 1000, but declare the range your font file really contains. Italics often come in a separate file, which gets its own rule with font-style: italic.
Google Fonts also serves variable fonts. Ask for a range with two dots, such as 200..900, instead of a list of separate weights:
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Sans+3:[email protected]&display=swap">
Font Axes
Variable Fonts define their variations through “axes.” There are 5 standard axes:
- ital – controls italic, from 0 to 1. You can turn it on with
font-style: italic. - slnt – controls the slant of the font. You can set it with
font-style: obliquefollowed by an angle. - opsz – controls the optical size. Browsers apply it automatically, and
font-optical-sizing: noneturns it off. - wght – controls the font weight. You can set the value using the font-weight property.
- wdth – controls the font width. You can set it with the font-stretch property, as a percentage.
As we mentioned at the beginning of the post, you can also create custom axes, which will receive 4 uppercase letters.
You can change the standard axes with familiar CSS properties, such as font-weight for wght. Custom axes need another property, called font-variation-settings.
For example, we can control the Roboto Flex variable font and two of its custom axes, grade (GRAD) and counter width (XTRA):
h1 {
font-family: 'Roboto Flex', sans-serif;
font-variation-settings: "wght" 322, "GRAD" 50, "XTRA" 500;
}
A better way is to set the weight with its own property:
h1 {
font-family: 'Roboto Flex', sans-serif;
font-weight: 322;
font-variation-settings: "GRAD" 50, "XTRA" 500;
}
Use native CSS properties for the standard axes whenever you can. Two more details are worth knowing about variable fonts:
font-weightaccepts any value from 1 to 1000, not only steps of 100.font-style: obliqueaccepts any angle from-90degto90deg.- Not every variable font contains all five registered axes.
So, let’s take a look and see how to check which properties exist for a specific parametric font…
How to Discover Which Axes and Properties Exist for a Variable Font?
To know which axes or “properties” a specific font supports, especially when it comes to the web, you may want to do one of the following: check the font in Firefox or use the website wakamaifondue.com, which translates freely to “what can my font do?”.
In the case of this website, you can simply drag the font file and get a full report describing which features exist for the font, in which languages it is supported, the file size, the number of glyphs, all the different axes the font supports, and even the minimum and maximum values of each of these (among other things).
Similarly, you can also get similar information about fonts and parametric fonts and their axes in newer versions of Firefox. Just inspect an element of text and click on the Fonts tab:
Note that in the bottom right part of the image, you can see all the existing axes, their values, and the “tags” of those axes represented by 4 letters in English.
Note that “registered axes” are always written in lowercase (wght, wdth, ital, slnt, opsz), while custom axes will always appear in uppercase.
What About Browser Support for Variable Fonts?
All major browsers support variable fonts, starting with Chrome 66, Edge 17, Firefox 62, and Safari 11. Can I use puts global support at about 97% (November 2026).
Visitors on older browsers see your fallback font, so end every font-family list with a generic family such as sans-serif.
More Examples Using a Parametric Font
Browse the web and you’ll find plenty of cool examples using fonts with parameters, both with JavaScript integration and without. Hover over the first example, for instance, and see the result:
And another one:
Another example that showcases the capabilities of variable fonts can be found on the Decovar font developer’s website, which I used for the examples I presented in the post. You can also find at alefalefalef.co.il a number of parametric fonts available for purchase, one of which is Caravan created by Avraham Cornfeld.
Summary
To summarize, you can find and play with most of the existing variable fonts existing on the V-fonts.com website. Some free variable fonts worth a look are Roboto Flex, IBM Plex Sans, Source Sans 3, and Amstelvar.
You’ll find that these font files are generally in TrueType format (TTF extension), but for websites, it’s much more appropriate to use a compressed format like WOFF2 to keep the file size smaller for loading times. You can use tools like FontTool to compress the file to this format.
There’s a lot more to say about variable fonts, but I hope you’ve got a good starting point to understand the subject and the ability of these fonts. I also have a lot more to learn about this interesting topic. Questions and comments are welcome…. 🙂
