
In the early days of web design, our typographic choices were limited to "web-safe" fonts like Arial or Times New Roman. When web fonts finally arrived, they revolutionized visual storytelling but came with a heavy price: performance. To have a design with a Light, Regular, Semibold, and Bold weight—plus italics for each—you had to force users to download eight separate font files.
Today, that paradigm is shifting. Variable fonts (officially known as OpenType Font Variations) are the secret weapon for developers and designers who refuse to compromise between high-end aesthetics and lightning-fast performance.
In a traditional font setup, each style (Weight, Width, Slant) is a static file. If you need a slightly bolder "Medium" weight that isn't in your bundle, you’re out of luck.
A variable font is a single binary file that contains the entire design space of a font family. Instead of discrete files, it uses "axes" of variation. Think of it as a single file that contains a "master" outline and instructions on how those outlines should shift to become thinner, wider, or more slanted.
Variable fonts operate along axes. There are five standard (registered) axes, though type designers can create custom ones as well:
wght): Adjusts how thin or thick the strokes are.wdth): Adjusts how narrow or wide the characters are.slnt): Adjusts the lean of the characters.ital): A binary or range toggle for italicization.opsz): Automatically adjusts letter spacing and stroke thickness based on the font size to maintain legibility.Implementing a variable font is remarkably straightforward. Within your @font-face declaration, you simply define the range of the axes available.
@font-face {
font-family: 'InterV';
src: url('Inter-VariableFont.woff2') format('woff2-variations');
font-weight: 100 900;
font-display: swap;
}
body {
font-family: 'InterV', sans-serif;
/* Fine-tune weight with precision */
font-weight: 450;
}
To access specific axes that aren't covered by standard CSS properties, we use font-variation-settings:
h1 {
/* Setting weight to 800 and width to 120% */
font-variation-settings: "wght" 800, "wdth" 120;
}
Instead of making four or five requests for different font files, the browser makes just one. This reduces the overhead of establishing multiple connections and significantly lowers the "Total Blocking Time" (TBT) during page load. While a single variable font file might be slightly larger than a single static file, it is almost always smaller than the combined size of three or more static weights.
With static fonts, you are stuck with the weights you've loaded. With variable fonts, you can use CSS media queries to subtly shift the font weight as the screen size changes. For example, you might want a slightly heavier weight on mobile devices to improve readability against bright backlights, or a narrower width for headers to prevent awkward word breaks on small screens.
@media (max-width: 600px) {
h1 {
font-variation-settings: "wght" 700, "wdth" 85;
}
}
Because variable font axes are numerical ranges, they are fully animatable. You can transition a font from a thin weight to a heavy weight on hover, or pulse the width of a character to draw attention to a CTA—all without the "jumpiness" associated with switching between static font files.
While variable fonts are supported in all modern browsers (Chrome, Firefox, Safari, and Edge), it is still best practice to provide a fallback for older environments.
font-weight over font-variation-settings: Whenever possible, use the standard CSS properties (font-weight, font-stretch) as they are more accessible to screen readers and easier for other developers to read.Variable fonts aren't just a gimmick for experimental designers; they are a fundamental upgrade to the web's infrastructure. By combining the flexibility of a full design system with the efficiency of a single file, they allow us to build websites that are both typographically rich and incredibly fast.
If you haven't made the switch yet, now is the time to audit your font stack and see how much performance you can reclaim with a single, variable file.
Photo by Google DeepMind on Pexels