Skip to content

Type scale

Build a modular type scale with line heights, see it in real text, and find out how fluid sizes behave under browser zoom. Everything runs in your browser, and the link keeps your choices.

Runs in your browserFluid sizesZoom check

Choices

Ratio
Labels
Unit

Tidier numbers for design files. Steps drift slightly from the ratio.

Grow each step between two screen widths with clamp().

Scale

Each step of the scale, largest first, with its size and line height.
StepSizeLine heightCopy
4xl3.0518rem48.83 px1.15
3xl2.4414rem39.06 px1.22
2xl1.9531rem31.25 px1.29
xl1.5625rem25 px1.36
lg1.25rem20 px1.43
base1rem16 px1.5
sm0.8rem12.8 px1.5

Checks

  • Every step is differentNo two steps share a size.Pass
  • Smallest size is 12.8 pxsm stays at 12 px or above.Pass
  • Body line height is 1.5Reaches the 1.5 spacing in WCAG 1.4.8 (AAA).Pass
  • Sizes follow the browser's font sizeRem values grow with that setting.Pass
  • Zoom enlarges every step fullyFixed sizes use no viewport units.Pass

These check the numbers. They can't tell you a page conforms to WCAG, so test it in a browser too.

Preview

Typeface

Hierarchy

4xl

Every step earns its place

3xl

Every step earns its place

2xl

Every step earns its place

xl

Every step earns its place

lg

Every step earns its place

Body text

Reading comes first

A type scale gives each level of a page a clear job. Headings stand apart, body text stays easy to read for a long time, and small print stays out of the way. Change the ratio and watch how far apart the levels sit.

Line length matters as much as size. This column stops at 65 characters, inside the 80 that WCAG's AAA guidance allows.

Small print sits one step below the body text.

Export

type-scale-theme.css
/* Type scale: 16px base, 1.25 ratio. */
@theme {
  --text-sm: 0.8rem;
  --text-sm--line-height: 1.5;
  --text-base: 1rem;
  --text-base--line-height: 1.5;
  --text-lg: 1.25rem;
  --text-lg--line-height: 1.43;
  --text-xl: 1.5625rem;
  --text-xl--line-height: 1.36;
  --text-2xl: 1.9531rem;
  --text-2xl--line-height: 1.29;
  --text-3xl: 2.4414rem;
  --text-3xl--line-height: 1.22;
  --text-4xl: 3.0518rem;
  --text-4xl--line-height: 1.15;
}

How it works

Sizes and rounding

Each step is the base multiplied by the ratio once more than the step below it. Pixels are kept to 2 decimals and rem values to 4, with 1 rem as 16 px. “Round to whole pixels” rounds first, so every other value comes from the rounded size. Small ratios can round two steps to the same size, and the checks name them.

Line heights

Large text needs less space between lines than body text. Steps at or below the base use the body line height, and steps above it move in equal amounts to the heading line height at the top step. Values have no unit, so they stay in proportion if a size changes.

Fluid sizes and zoom

A fluid step grows between two screen widths using clamp(). It keeps a rem part beside the vw part, because text sized with viewport units alone doesn't respond to zoom. That still isn't the whole story. Zooming a page makes its viewport narrower in CSS pixels, so a fluid size shrinks back as you zoom in, and 200% zoom gives less than twice the size.

The zoom check works this out for every step, at the largest width, where the effect is strongest. It reports the lowest browser zoom where every step reaches twice its size. A step with a maximum over 2.5 times its minimum can't get there, even at 500%. People who raise their browser's default font size are a separate case: only the rem part grows for them. This is arithmetic on the CSS, so test real pages too.

The exports

The Tailwind export is a @theme block for Tailwind CSS v4, where --text-lg and --text-lg--line-height give text-lg both values. Tailwind's other sizes stay available; add --text-*: initial; first to remove them.

The DTCG export uses the 2025.10 format, with dimension tokens for sizes and number tokens for line heights. A dimension can't hold clamp(), so a fluid scale exports its small and large sizes as two groups. There are no typography tokens, because the format expects a font family, weight and letter spacing that this tool doesn't choose.

Not covered yet

  • Choosing or pairing fonts. A size looks different in every typeface, so check yours.
  • Baseline grids, letter spacing and font weights.
  • Sizes for more than two screen widths.