CSS Typography Token Generator

Token source

Tokens emitted21
Size range10.24 – 61.04px
Full scale factor5.96×

Token names run 2xs → 4xl across steps −2 → +6. Line-heights pair with each step: 1.6 for small text, 1.5 for body, tightening to 1.15 at the top of the scale.

CSS tokens
:root {
  --font-size-2xs: 10.24px;
  --font-leading-2xs: 1.6;
  --font-size-xs: 12.8px;
  --font-leading-xs: 1.6;
  --font-size-sm: 16px;
  --font-leading-sm: 1.5;
  --font-size-base: 20px;
  --font-leading-base: 1.4;
  --font-size-lg: 25px;
  --font-leading-lg: 1.25;
  --font-size-xl: 31.25px;
  --font-leading-xl: 1.15;
  --font-size-2xl: 39.063px;
  --font-leading-2xl: 1.15;
  --font-size-3xl: 48.828px;
  --font-leading-3xl: 1.15;
  --font-size-4xl: 61.035px;
  --font-leading-4xl: 1.15;
  --font-family-body: Inter, system-ui, sans-serif;
  --font-family-heading: Fraunces, Georgia, serif;
  --font-family-mono: 'JetBrains Mono', ui-monospace, monospace;
}
JSON tokens
{
  "font": {
    "size": {
      "2xs": "10.24px",
      "xs": "12.8px",
      "sm": "16px",
      "base": "20px",
      "lg": "25px",
      "xl": "31.25px",
      "2xl": "39.063px",
      "3xl": "48.828px",
      "4xl": "61.035px"
    },
    "leading": {
      "2xs": 1.6,
      "xs": 1.6,
      "sm": 1.5,
      "base": 1.4,
      "lg": 1.25,
      "xl": 1.15,
      "2xl": 1.15,
      "3xl": 1.15,
      "4xl": 1.15
    },
    "family": {
      "body": "Inter, system-ui, sans-serif",
      "heading": "Fraunces, Georgia, serif",
      "mono": "'JetBrains Mono', ui-monospace, monospace"
    }
  }
}

You Might Also Need

The CSS typography token generator exports one modular scale twice: as a block of CSS custom properties and as a JSON token object. Sizes and leading ship together, so a token carries the pairing rather than leaving it to whoever consumes it.

What is CSS Typography Token Generator?

The CSS typography token generator turns a base size, a ratio and three font stacks into a token set that can be dropped into a design system. It emits the same values twice — as CSS custom properties for a stylesheet and as a JSON object for whatever build step consumes tokens — which is the practical way to keep one source of numbers in a project that has both.

The token set has a fixed shape, described by the panel before anything is generated.

  • Nine size steps named from 2xs to 4xl, running from two steps below the body to six above it, so the scale covers small print and display sizes in one ladder.
  • A paired line height for each step, loosening to 1.6 at the small end, holding at 1.5 for body, and tightening to 1.4, 1.25 and then 1.15 as the steps grow.
  • Three family tokens — body, heading and monospace — carried as complete stacks rather than as single family names, so a token can be applied without a second fallback decision.

The emitted set is twenty-one declarations: nine sizes, nine leadings and three families. Two readouts describe the scale's span rather than its contents: the size range, from the smallest step to the largest in pixels, and the full scale factor, which is the largest size divided by the smallest and therefore the number that says how dramatic the ladder is. A prefix control renames the token namespace, so the set can land as a project's own tokens rather than as a generic one, and the JSON mirrors the same three groups with sizes and leadings as keyed objects.

The interesting decision the tool makes for you is the leading pairing. A modular scale produces sizes, not line heights, and design tokens that ship sizes alone leave every consumer to guess the leading. Pairing them by rule — looser at the small end, tighter at the top — matches what a designer would do by hand and keeps the relationship stable when the base size changes.

What the tool does not do is scale fluidly, and a few other decisions are left outside it.

  • Every pixel value is fixed, so a responsive project still needs clamp declarations on top, and the heading scale visualizer is the tool for that layer.
  • The leading values are paired by rule rather than measured, so a face with unusual vertical metrics may need one or two of them adjusted after a look at real paragraphs.
  • The JSON and the CSS are generated side by side but nothing keeps them in step afterwards, so editing one output by hand starts a divergence that is invisible until a release.
  • The token names are fixed to the nine-step ladder, so a project whose scale has a different number of steps renames or extends the set by hand.
  • No spacing tokens are emitted, so the margins between type blocks stay outside the system even though the sizes and leadings are inside it.

Used as the single source for type values, the block turns a scale into something a build step and a stylesheet can share; the discipline is copying it rather than editing it.

How to use CSS Typography Token Generator

  1. Set the base size and the ratio, then read the size range and full scale factor to check the ladder is as dramatic as the design needs.
  2. Set the prefix so the tokens land in the project's own namespace, and confirm in the CSS output that no name collides.
  3. Replace the three family stacks with the project's real stacks, since they ship as complete fallback chains.
  4. Copy both outputs — the custom properties into the stylesheet and the JSON into the token pipeline — and treat the generated block as the source rather than editing either by hand.

When to use CSS Typography Token Generator vs related tools

Reach for it when a type scale has to be handed to a build step as well as to a stylesheet, when a project has sizes but no agreed leading per size, or when a design system needs a scale named consistently from small print to display. The paired leading is the part that saves the most argument. For the steps themselves the modular scale calculator and the type scale generator derive the ladder, the heading scale visualizer adds the fluid clamp layer on top, and the letter spacing calculator supplies the tracking values that belong to each step.

Privacy & Security

This tool runs entirely in your browser — no data ever leaves your device. There is no server round-trip, no upload, no logging, and no account required. Your input is processed locally using client-side JavaScript and is never stored, transmitted, or accessible to anyone else. When you close the tab, everything disappears.

Frequently asked questions about CSS Typography Token Generator