Make your web fonts smaller.

Split fonts around the text on your site. Check the result in Chrome.

$pnpm dlx fontphobia@0.9.1

One font, three files

Core holds the characters your pages use. Extended holds the Latin letters none of them use yet. Rest holds everything else in the font. The browser loads core first, then another file only when text needs it.

A character that few pages use could go in core or in extended. fontphobia measures both and keeps the one where your pages download less in total.

InterOriginal · 341.3 KB
SubsettedLoaded as needed
FrauncesOriginal · 65.7 KB
SubsettedLoaded as needed
CoreExtendedRest
The example site's fonts, to scale. Together the three files are larger than the original. A page downloads only the ones it needs.

Try some text

Change the text. Watch the files it needs. This uses the fonts on this page.

Browse the example site

Little Levain's home page, with large serif type and a photograph of sourdough loaves.
Little Levain · a fictional bakery, with measured downloads

78% less font data

Same photos, content and interactions.
Cold-cache downloads · before → after
PageFontsWhole page
Home407.1 KB →91.1 KB78% less1039.5 KB →727.1 KB30% less
Menu407.1 KB →91.1 KB78% less513.3 KB →201.0 KB61% less
Visit us407.1 KB →91.1 KB78% less624.7 KB →312.4 KB50% less
Journal407.1 KB →91.1 KB78% less624.8 KB →312.4 KB50% less

Beyond ASCII and common punctuation, the pages use ° · ½ â ç è é û € →. All of them are in core, so every page downloads the core files alone.

Same layout across all 16 browser checks.

How it's measured and checked

Cold-cache visits at 390 px and 2× density, with every photo loaded. Sizes count response bodies: HTML, CSS, JavaScript, photos and fonts. They exclude headers and gzip savings on text.

Only the fonts change. The baseline self-hosts full Inter and Google's Latin Fraunces. Sites already using language subsets may save less.

Font verification passed 32 comparisons. Separate checks of the published copies cover all four pages at 390 and 1280 px, at 1× and 2× density, plus a filtered menu.

Text pixels matched within one RGB level per channel. Photos have identical bytes, positions and sizes; they are masked for pixel checks because Chrome can resample the same JPEG differently. The text tolerance covers colour noise also seen with unchanged fonts. Strict and unmasked counts are in the raw results.

The bakery menu with search, category filters and a vegan-only checkbox.
Try “creme”, Pastry or Vegan only in either version.

Full measurements · Source and photo credits

Exact file sizes and build output
The bakery's generated fonts
FileSize
Fraunces core45.0 KB
Fraunces extended41.3 KB
Fraunces rest22.0 KB
Inter core46.1 KB
Inter extended185.8 KB
Inter rest192.7 KB

HarfBuzz checks words before splitting. Characters move into core if a split changes their shaping. Axes, hinting, font features and glyph names are kept.

Face                          Now     Core       Ext      Rest         Median page  Saved
Fraunces 100 900 normal   65.7 KB  45.0 KB   41.3 KB   22.0 KB   65.7 KB → 45.0 KB    32%
Inter 100 900 normal     341.3 KB  46.1 KB  185.8 KB  192.7 KB  341.3 KB → 46.1 KB    86%

Font bytes per page: median 407.1 KB → 91.1 KB (78% less); biggest drop / 407.1 KB → 91.1 KB

Core choice: used characters put in core so the pages download less in total
  Fraunces 100 900 normal: 4 character(s) (½ è é û); 4 of 4 page(s) load only the core file
  Inter 100 900 normal: 9 character(s) (° · â ç è é û € →); 4 of 4 page(s) load only the core file

Opt-ins (would change rendering, not applied; `--allow <name>` applies one):
  limit-axes     saves  73.3 KB  opsz 9–72, wght 400–900; text widths shift up to ~0.02% (whole pixels on Linux at 1×) (2 faces)
  drop-hint-refs saves  17.6 KB  characters from the extended file hint differently on Linux and ChromeOS (FreeType's auto-hinter) (2 faces)

Font files and CSS
  6 output file(s): bytes match the manifest, they decode and validate, and the CSS loads them with the original descriptors

Shaping equivalence
  fraunces-100-900-normal: 95 word(s), 380 case(s): 380 identical
  inter-100-900-normal: 632 word(s), 2422 case(s): 2422 identical

In the browser ("before" is this build with the original fonts swapped back)
  chromium 157.0.8103.39 · 4 page(s) · 32 comparison(s): 32 identical, 0 sub-pixel rounding, 0 regression(s)

Font bytes per page
  median 407.1 KB → 91.1 KB (78% less)
  /                               407.1 KB →   91.1 KB  (2 → 2 requests)
  /about.html                     407.1 KB →   91.1 KB  (2 → 2 requests)
  /journal/levain.html            407.1 KB →   91.1 KB  (2 → 2 requests)
  /menu.html                      407.1 KB →   91.1 KB  (2 → 2 requests)
  every extended and rest file loaded only on pages that use one of its characters

Verify passed: no differences.

pnpm bakery:build reproduces these copies, measurements and screenshots. Pages checks their hashes before publishing.

Build report · Font file data

See a change the rendering check caught

The optional limit-axes build saves another 73.3 KB, but fails verification. The browsable demo uses the defaults.

“Prices in euros.”

Magnified menu diff around Prices in euros, with changed pixels shown in orange.
Changed pixelsText for context
Full diffOriginal PNG (720 × 8070)Full limit-axes menu diff, with changed pixels in orange.
Measured at 360 px and 2× density. Detail enlarged, contrast increased, photos masked.
Verification output
Font files and CSS
  6 output file(s): bytes match the manifest, they decode and validate, and the CSS loads them with the original descriptors

Shaping equivalence
  fraunces-100-900-normal: 95 word(s), 380 case(s): 0 identical, 373 within limit-axes rounding (outlines ≤ 1.4 units, advances ≤ 1), 7 differ
  inter-100-900-normal: 632 word(s), 2422 case(s): 1120 identical, 1272 within limit-axes rounding (outlines ≤ 0.5 units, advances ≤ 1), 30 differ
  regression: fraunces-100-900-normal: 7 of 380 shaping case(s) differ from the source; e.g. " Levain" (calt=0,clig=0,dlig=0,hlig=0,liga=0 opsz=72,wght=750): glyph 3 (cluster 3): advance 1018 → 1020
  regression: inter-100-900-normal: 30 of 2422 shaping case(s) differ from the source; e.g. " Coffee " (opsz=20,wght=400): glyph 4 (cluster 4): advance 667 → 669

In the browser ("before" is this build with the original fonts swapped back)
  chromium 157.0.8103.39 · 4 page(s) · 4 comparison(s): 0 identical, 0 sub-pixel rounding, 4 regression(s)
  regression: / @360px DPR 2: width changed (shaping or advance widths); pixels differ at identical layout (glyph rasterization or sub-pixel glyph positions) (9 of 51 text boxes moved, up to 0.06 px), 25094 px differ
      "Little Levain" (body > div.container > header.site-header > a.brand): width changed (shaping or advance widths)
      "Bread, baked" (main#content > section.hero:nth-of-type(1) > div > h1): width changed (shaping or advance widths)
      "every morning." (main#content > section.hero:nth-of-type(1) > div > h1): width changed (shaping or advance widths)
      diff: .fontphobia/verify/index@360x2.chromium.png
  regression: /about.html @360px DPR 2: width changed (shaping or advance widths); pixels differ at identical layout (glyph rasterization or sub-pixel glyph positions) (11 of 45 text boxes moved, up to 0.08 px), 22928 px differ
      "Little Levain" (body > div.container > header.site-header > a.brand): width changed (shaping or advance widths)
      "Two bakers." (main#content > section.hero:nth-of-type(1) > div > h1): width changed (shaping or advance widths)
      "One oven." (main#content > section.hero:nth-of-type(1) > div > h1): width changed (shaping or advance widths)
      diff: .fontphobia/verify/about.html@360x2.chromium.png
  regression: /journal/levain.html @360px DPR 2: width changed (shaping or advance widths) (18 of 46 text boxes moved, up to 0.06 px), 35825 px differ
      "Little Levain" (body > div.container > header.site-header > a.brand): width changed (shaping or advance widths)
      "Notes on levain." (main#content > article.prose > h1): width changed (shaping or advance widths)
      "What our starter does all day, and why …" (main#content > article.prose > p.lede:nth-of-type(2)): width changed (shaping or advance widths)
      diff: .fontphobia/verify/journal_levain.html@360x2.chromium.png
  regression: /menu.html @360px DPR 2: width changed (shaping or advance widths) (12 of 80 text boxes moved, up to 0.06 px), 27573 px differ
      "Little Levain" (body > div.container > header.site-header > a.brand): width changed (shaping or advance widths)
      "On the counter." (main#content > section.page-heading > h1): width changed (shaping or advance widths)
      " Everything is baked on site. This is o…" (main#content > section.page-heading > p.lede:nth-of-type(2)): width changed (shaping or advance widths)
      diff: .fontphobia/verify/menu.html@360x2.chromium.png

Font bytes per page
  median 407.1 KB → 74.5 KB (82% less)
  /                               407.1 KB →   74.5 KB  (2 → 2 requests)
  /about.html                     407.1 KB →   74.5 KB  (2 → 2 requests)
  /journal/levain.html            407.1 KB →   74.5 KB  (2 → 2 requests)
  /menu.html                      407.1 KB →   74.5 KB  (2 → 2 requests)
  every extended and rest file loaded only on pages that use one of its characters

Verify failed. Diff images are in .fontphobia/verify. `fontphobia revert` restores the original fonts.

Run it on your site

You'll need Node.js 22+ and Google Chrome. In your project folder:

your project
pnpm dlx fontphobia@0.9.1

Review the plan, approve the edits, then see the rendering check.

What the command does
  1. Audit. Open each page in Chrome and record its text and font settings.
  2. Plan. Split each font into core, extended and rest. Repair words that lose kerning.
  3. Build. Write WOFF2 files and update the CSS. Keep axes, hinting and font features.
  4. Verify. Compare the original and optimized pages in Chrome.

Add fontphobia check to your build to catch new text and stale files.

Subset on every build instead

fontphobia auto subsets a built site inside its output folder. It edits no source file and leaves nothing to commit, so there is no check to run.

after your build
pnpm build && pnpm dlx fontphobia@0.9.1 auto
  • No browser by default. It reads the text of the built pages. Every run checks that the new files decode, match their sources and shape each word the same, and puts the output back if a check fails.
  • --crawl measures each font in Chrome and writes the same files as the full workflow.
  • --verify adds the pixel comparison in Chrome. Run it when you adopt auto mode or change a font.

The framework integrations take auto: true to do this at the end of each build. Auto mode needs prerendered pages and leaves fonts served by Google or Adobe alone.

Supported font sources

fontphobia edits fonts where they are declared:

SourceWhat fontphobia does
Your own @font-face rules in CSS, Sass, Less, or <style> in Vue, Svelte and AstroCore, extended and rest, in place
Fontsource packagesCopies the package CSS into your project and subsets each slice a page uses
Google Fonts links and next/font/googleReports unused weights; with self-host or eject, serves the exact files Google sent from your site, split
Astro Fonts APIPreloads only the faces pages use; with eject, serves them from your site, split
@nuxt/fontsReports unused weights and families loaded twice; with eject, splits them
next/font/localOne subset file per face
Adobe FontsNever touches Adobe's files; apply-kit removes kit styles nothing uses

Fonts need a recognised open licence, such as OFL or Apache 2.0. Reserved Font Names are renamed inside the files; your CSS family names stay the same.

Commands and options · CI setup