Base64 Font Face Generator
Embed a font directly in your CSS as a Base64 data URI, so the page needs no separate font file request. Drop in a TTF, OTF, WOFF or WOFF2 file and the ready-to-paste @font-face rule is generated for you.
Embedding a font is one of several inlining techniques, alongside the Image to Base64 Converter and the SVG to Base64 Converter. The stylesheet carrying the result can be reduced first with the CSS Minifier.
How to use the Base64 Font Face
- 1 Upload a font file — TTF, OTF, WOFF or WOFF2.
- 2 Choose which formats to inline, since a single file embeds as one data URI.
- 3 Set the `font-family` name and the weight and style the rule should declare.
- 4 Copy the complete `@font-face` rule into your stylesheet.
When embedding is worth the cost
The case is strongest for very small fonts with a narrow purpose. An icon font of a dozen glyphs compresses to a few kilobytes, and removing its request means icons appear with the first paint rather than after a fetch — which eliminates the visible pop-in that otherwise follows a network round trip.
It is weakest for the main text face. A full Latin body font is typically 15–40 KB compressed, and inlining it as Base64 adds 33% on top while locking it into a stylesheet that must be downloaded and parsed before the text can render at all. A separate file request, with `font-display: swap` and a preload hint, performs better in every measurable way for that case.
- Inline icon fonts and single-glyph decorative faces.
- Keep full alphabets as separate, cacheable files.
- Order the `src` list so the modern format comes first.
- Always declare `font-display` to control what happens while the font loads.
When to embed a font
Embedding removes a network round trip and guarantees the font is available, which suits small icon fonts, a single display face, or offline and email HTML. It is a poor fit for large families: Base64 inflates a file by roughly a third, and the whole payload sits inside the CSS, so it cannot be cached separately or streamed.
Frequently asked questions
Does inlining a font actually improve performance?
It removes a round trip and guarantees the font is available at first paint with no flash of unstyled text, which can genuinely help for a single small font such as an icon set or a decorative heading face. For a body font it almost always hurts: Base64 inflates the file by a third, the font can no longer be cached separately across pages, and it cannot be loaded in parallel with anything else because it is locked inside the CSS file.
Why does my inlined font fail to load in some browsers?
Two common causes. A compressed WOFF or WOFF2 file is binary, and if any step of the pipeline corrupted the bytes the data URI decodes to garbage that the font parser rejects. The other is the format hint: the `format()` value must match the actual file, so a WOFF2 payload declared as `format('woff')` may be refused even though the data is valid.
What about font licensing?
Inlining does not change the licence, and it can make enforcement harder for the foundry rather than easier. Web font licences typically permit embedding on a specific domain with a pageview limit; inlining the file into a stylesheet and shipping that file anywhere else is a separate distribution. Check the terms before embedding, particularly for commercial faces.
Related Image & Color Tools
You might also need
Tools from other categories that people pair with the Base64 Font Face: