Font Face Generator
Create a CSS @font-face rule from a font file. Upload a TTF, OTF, WOFF or WOFF2 font and the tool reads its family name, weight, style and weight axis, then writes the rule with the font embedded as a base64 data URL or pointing to a file path, with your font-display choice and an optional unicode-range.
Frequently asked questions
Where do the family name, weight and style come from?
From the font's own tables: the family name from its name table, the weight from the OS/2 weight class and the style from its italic flags. For a variable font with a weight axis, font-weight becomes the axis range, such as 100 900. Enter a family name to use your own.
Should I embed the font as base64?
Embedding puts the whole font into the CSS, which saves a request but makes the CSS about a third larger than the font and blocks rendering until it loads. For most sites a separate WOFF2 file is better; embedding suits small icon fonts, emails or single-file pages.
Which font-display value should I choose?
swap shows fallback text at once and switches when the font arrives, which is common for body text. optional uses the font only if it loads very quickly, block hides text briefly to avoid a visible switch, and fallback sits between swap and optional.
What does unicode-range do?
It lists the characters the font contains, so browsers only download the font when a page uses one of them. It is most useful when you split a font into subsets, for example with the Font Subsetter.
Which format string is used?
woff2, woff, truetype or opentype, matching the uploaded file. Convert TTF and OTF files to WOFF2 with the Font Converter first for smaller downloads.
Is the font file changed?
No. The base64 data is the uploaded file exactly as it is. The tool only reads the font to fill in the CSS properties.