Font · 11 tools · nothing uploads

Embed a font as a CSS data URI

Base64 a font file into a self-contained `@font-face` rule, no separate file to host, at the cost of the file growing about a third larger as text. Fine for a small icon font, wasteful for a large family.

Input

Options

Embed a font as a CSS data URI turns a font file into one base64-encoded @font-face block, with the format guessed from the file's magic bytes rather than its name. Leave family blank and it uses the font's own name, falling back to CustomFont. The output grows about a third larger as base64 text than the original binary.

Questions

How is the font format detected?

By reading the first four bytes of the file itself, its magic bytes, rather than trusting the file extension: wOFF becomes WOFF, OTTO becomes OpenType, and the sfnt version bytes for TrueType are matched directly; a WOFF2 file never reaches this check, since the font parser it depends on cannot decompress WOFF2 and rejects it earlier.

What happens if I leave family blank?

The tool reads the font's own family name out of its name table and uses that; if the font has no family name set at all, it falls back to the literal name CustomFont.

How much bigger does the output get?

About a third larger than the original binary font file, since base64 encoding always expands binary data by roughly that ratio; there is no compression step to offset it.

What does the generated CSS contain?

One @font-face rule with the family name, a src url pointing at a base64 data URI in the detected format, and font-weight and font-style both set to normal; there is no option to set a different weight or style.

Is this a good fit for a large font family?

Not particularly, by the tool's own description: the roughly one-third size increase from base64 makes it a reasonable choice for a small icon font and a wasteful one for a large multi-weight family, where hosting the font as a separate file stays smaller.

Compare

Related Font tools

1→1Convert a font to OTFRe-encode a TTF, OTF or WOFF font as OpenType/CFF (.otf). This build of opentype.js only writes CFF outlines (verified by execution: it always emits the OTTO sfnt tag, never TrueType glyf, regardless of the source format), so OTF is the one honest direction: a real outline-format change coming from a TrueType source, a clean re-serialize coming from an OTF one.Takes one file1→1Subset a font to specific charactersDrop every glyph except the characters you list. A smaller file that still renders exactly the text you use.Takes one file1→1Render a font specimen sheetDraw a sample of a font's own glyphs to a PNG. It flattens the real bézier outlines and fills them with a nonzero-winding scanline rasterizer (no <canvas>, no upload), so what you see is what the font file contains.Takes one file1→1Export font glyphs as SVGTurn specific characters into standalone SVG files, one per glyph, using the font's own bézier outlines, normalised to a 1000-unit em so files from different fonts are comparably sized.Takes one file1→1Convert text to an SVG pathSet a line of text in a font and get back one SVG with a single `<path>` element, the outlines, not a `<text>` tag, so it renders identically everywhere without the font installed.Takes one file1→1Turn an icon font into an SVG spriteConvert every mapped glyph in an icon font (Font Awesome, Material Icons, ...) into one SVG sprite of `<symbol id="uXXXX">` elements, so a page can `<use href="#u...">` an icon without loading the font at all. Capped at 2000 glyphs.Takes one file