Generate an @font-face rule

A self-hosted font needs three things: a WOFF2 file, a rule that points at it, and a fallback that stops the page jumping when it loads. This writes all three from the font itself.

Generate an @font-face rule

Drop your font files here

Or choose files from your device

TTF, OTF, WOFF, WOFF2, TTC or OTC in · up to 20 files · max 40 MB each

Every file is parsed and converted in this tab. Nothing is uploaded.

    No font added yet.

    Three steps — nothing to install

    1. Drop the font

      TTF or OTF. The generator reads the real family name, the weight class and whether the face is italic.

    2. Convert with CSS

      The page opens in @font-face mode: you get a .woff2 download plus the CSS that references it.

    3. Paste it in

      Put the file in /fonts/, paste the rule into your stylesheet and the preload tag into the head of the page that uses it.

    Why self-host instead of loading from a font CDN

    A hosted font service sees the request, the referrer, the visitor's IP and the page they are on. That is a third-party request on every page view, and in the EU it has been treated as a transfer of personal data. Self-hosting removes the request entirely: the font comes from your own domain, under your own privacy policy.

    It is also faster. One origin means no extra DNS lookup and no second TLS handshake, and you control the cache headers.

    Why the fallback stack matters

    A web font arrives after the first paint, so text either waits (invisible) or renders in the fallback and then swaps. Both cause a shift unless the fallback is metrically close. Listing system-ui and a generic family, then tuning with size-adjust if needed, keeps the layout still.

    The generated CSS uses font-display: swap and a system-font fallback; if your layout still jumps, measure the two fonts and add size-adjust to the fallback rule.

    Frequently asked questions

    Is the CSS ready to paste?Yes — the rule, a preload tag and a fallback stack are generated together. Change the /fonts/ path if your files live somewhere else.
    Does it read the weight and style?It does: weight comes from the OS/2 table and italic from the head table, so the @font-face rule matches the face instead of guessing 400 normal.
    Should I add a WOFF fallback?Only if you must support browsers older than 2016. Add a second src entry pointing at the WOFF file; the browser downloads just the one it understands.
    Can I keep the hard-coded family name?Yes. Type your own family name in the field and it is used instead of the one in the font's name table.