1. Home
  2. Design tools
  3. @font-face Rule & Preload Generator

@font-face Rule & Preload Generator

List your font files and get the CSS and head tags to load them well.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use @font-face Rule & Preload Generator

  1. Enter the family name and each face’s files and weight.
  2. Choose font-display and the fallback stack.
  3. Copy the CSS and the preload tags.

Features

  • Several faces with weight and style
  • WOFF2, WOFF and TTF sources ordered correctly
  • font-display, unicode-range and local() options
  • Preload tags with crossorigin
  • Fallback font stacks
  • Variable weight ranges

Supported formats

Input

  • File addresses and weights

You get

  • CSS
  • HTML link tags

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the @font-face Rule & Preload Generator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • It writes the rules but does not check that the files exist at the addresses.
  • Unicode-range values are taken as typed.

Guide

Writing @font-face rules, preload tags and fallback stacks

A custom font only works if the browser knows where to find it, which family name and weight it stands for, and what to show while it loads. All of this lives in @font-face rules, and small mistakes, such as a wrong format hint, a missing crossorigin or a weight that does not match, lead to fonts that silently fail to load or load twice. This page builds the rules from a short form and gives you the HTML to go with them.

What a rule says

An @font-face rule describes one face of a family. font-family is the name you will use in CSS. src lists files, each with a format() hint so the browser skips what it cannot read without downloading. font-weight and font-style say which weight and style the file provides, so font-weight: 700 picks the bold file. font-display controls what happens during loading. Optionally, unicode-range limits the characters the file covers and local() tries a copy installed on the visitor’s device first.

A worked example

Press Sample to load an Inter family with three faces. Regular has WOFF2 and WOFF files, Italic has WOFF2 only, and Bold has both again. The output opens with @font-face { font-family: "Inter"; src: url("/fonts/inter-regular.woff2") format("woff2"), url("/fonts/inter-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; } and continues with the italic rule (font-style: italic) and the bold rule (font-weight: 700). A body rule follows: font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;. The preload box lists three tags such as <link rel="preload" href="/fonts/inter-regular.woff2" as="font" type="font/woff2" crossorigin>.

Order and formats

The browser walks the src list from the top and takes the first format it supports, so WOFF2 comes first, then WOFF, then TrueType or OpenType. Most sites now ship only WOFF2, which every current browser reads, but a WOFF entry costs nothing if you have the file. If you give a TTF address ending in .otf, the format hint is opentype; otherwise it is truetype. For a variable font, enter a weight range such as 100 900 in one rule and a single file.

Loading behaviour

swap shows text at once in the fallback font and swaps when the font arrives; fallback allows a short swap window; optional uses the font only if it arrives almost immediately, which avoids layout shift; block hides text for a short period. Preload tells the browser to fetch a font early, before the CSS has been parsed. Do it for the one or two faces used above the fold, since preloading all of them competes with other resources.

Fallback stacks

The fallback stack decides how the page looks before the font loads and whenever it fails. Choose sans-serif, serif or monospace and the page writes a stack of system fonts that suit it, ending with the generic family. Pick a fallback with similar proportions to the web font to reduce the jump when it swaps in.

Edge cases

Weights must be numbers; the form warns when the value is not like 400 or 100 900. A face with no file address is skipped with a note. Weight and style combinations that are not declared are synthesised by the browser, which looks worse than a real italic or bold. Case matters in file paths on most servers. The local() option looks for an installed font with the family name, and may pick up a different version than your file.

Limits

The generator does not check that the files exist or are valid fonts; use the font inspector for that. It writes CSS and link tags, not server headers: serve fonts with a long cache lifetime and Access-Control-Allow-Origin when they come from another domain. Everything is composed in your browser.

Checked against the current version of the @font-face Rule & Preload Generator on .

Troubleshooting

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why does the preload tag need crossorigin even for my own fonts?

Browsers fetch fonts in anonymous CORS mode. A preload without the crossorigin attribute uses a different mode, so the preloaded file is not reused for the font request and is downloaded twice.

Which font-display value should I choose?

swap shows text immediately in the fallback and swaps when the font arrives, which suits most sites. optional keeps the fallback if the font is not ready almost at once, avoiding layout shift. block hides text for a short time, which is rarely what readers want.

Why does a font preload need crossorigin?

Fonts are fetched in anonymous CORS mode, even from your own domain. A preload without the attribute is not reused and the font downloads twice.

Which font-display should I use?

swap shows fallback text at once and swaps when the font arrives. optional avoids the swap on slow connections, which prevents layout shifts.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.