A free browser-based tool that generates production-ready @font-face CSS declarations. Set font family, weights, styles, font-display, and file URLs — copy clean CSS in seconds with no signup or uploads.

Font Face Generator is a free, browser-based tool that builds @font-face CSS declarations for custom web fonts. Enter your font family name, add as many weight and style variants as you need, paste your font file URLs, and copy production-ready CSS instantly. No signup, no file uploads, no waiting.
Every web project that uses a self-hosted or CDN-hosted custom font needs @font-face CSS. The rule itself is not complex, but writing it correctly every time is tedious — especially when a font family spans multiple weights and styles.
A complete type system with four weights and their italic counterparts means eight separate @font-face blocks. Each block needs:
font-family name (consistent across all blocks)font-weight valuefont-style valuesrc line with the URL and the correct format() hintfont-display strategyThe format() hint is where developers make mistakes. .woff2 files need format('woff2'), .ttf needs format('truetype'), .otf needs format('opentype') — and these are easy to confuse or forget. A missing or wrong format hint can cause the browser to download a font file it can't use and then silently fall back to the system font.
Doing this correctly for eight variants, twice (for woff2 and woff fallbacks), is sixteen URL/format combinations to get right.
Enter your font family name once at the top. This becomes the value used in font-family: 'YourFont' across your entire stylesheet. Every @font-face block the tool generates uses exactly this name — consistent spelling guaranteed.
Click Add Variant for each weight and style combination you need. For each variant, set:
This gives you full control over every variable in the @font-face declaration. Add as many variants as your type system requires.
Paste the URL(s) for each variant's font file. You can provide multiple URLs per variant — one per line — to include multiple formats (woff2 and woff, for example). The tool detects the file extension and writes the correct format() hint automatically:
.woff2 → format('woff2').woff → format('woff').ttf → format('truetype').otf → format('opentype').eot → format('embedded-opentype')No manual format string entry needed.
The output panel updates in real time as you edit. Each @font-face block is properly indented and separated. When you're ready, click Copy CSS to copy the full output to your clipboard.
format() hint is added automaticallyThe tool is a pure client-side TypeScript implementation. The core logic is a generateCSS function that takes the font family name and an array of variant objects and produces correctly formatted CSS output.
A detectFormat utility maps file extensions to their W3C format() string. It strips query parameters from URLs before extension matching, so CDN URLs with cache-busting query strings are handled correctly.
Variant state is managed with React useState — each variant is an object with id, weight, style, display, and urls. Variants can be added, removed, and edited independently. The id field uses a short random string (uid()) for stable React keys, avoiding index-based key issues during reordering or deletion.
The generated CSS string is recomputed synchronously on every render — no memoisation is needed because the output is fast to compute and the component tree is shallow.
Variable fonts have a single file that covers all weights. Use the tool with font-weight: 100 900 (type this manually in the weight field) and a single woff2 URL to generate the correct @font-face declaration.
Google Fonts provides @font-face CSS automatically, but some teams prefer to control loading behaviour — specifically font-display. Generate the declarations manually with font-display: optional to skip fonts entirely if they are not cached, eliminating the layout shift.
Self-host a fallback web font with matching metrics to reduce FOUT (Flash of Unstyled Text) when the primary font comes from a third-party CDN. Use this tool to generate the @font-face declarations for the fallback font.
A design system typically defines 5–6 weights for its brand font, each with an italic variant. That is 10–12 @font-face blocks. Use this tool to generate the full set at once, then paste them into the design system's base stylesheet.
Some email clients support web fonts via @font-face. Generate the declarations here and paste them into the <style> block in the email template's <head>.
@import url('https://fonts.googleapis.com/...') is convenient but has significant downsides:
font-display (without the &display=swap URL parameter)Self-hosting with @font-face gives you:
font-display, font-weight, and format fallbacks<link rel="preload" as="font" href="...">)Font Face Generator removes the boilerplate from custom web font embedding:
format('truetype') on a woff2 fileTry it now: font-face-generator.tools.jagodana.com
The client needed a robust developer tools solution that could scale with their growing user base while maintaining a seamless user experience across all devices.
We built a modern application using CSS and Typography, focusing on performance, accessibility, and a delightful user experience.
Category
Developer Tools
Technologies
Date
June 2026
More work in Developer Tools