Skip to content
📐

Type Scale Generator

Build a modular type scale from a base size and a ratio, then copy it as CSS custom properties with an optional fluid clamp() version.

Runs in your browser

Updated

The scale

Preview

The quick brown fox jumps over the lazy dog

The quick brown fox jumps over the lazy dog

Choosing a ratio

A ratio near 1.2 is subtle and suits dense, content-heavy pages. Around 1.333 gives a clear hierarchy without drama and is a good default. Above 1.5 the steps grow fast, which suits a marketing page with few words per screen and breaks down on a dense blog.

Musical ratios are not "correct" typography — they are just named and easy to remember. Two steps either side of your base size is usually plenty; a ten-step scale is mostly a way to produce unreadable body text.

The arithmetic behind the table

Each row is base times ratio to a signed exponent, arranged so the base row sits in the middle. Values print with two decimals, or three under 10px, and rem to three decimals against a hard 16px root. The ten labels xs through 5xl are assigned by exponent, the base row gains a blue border and a chip, and Steps accepts 2 to 10 with 6 set.

A worked example

Base 16, perfect fourth 1.333, six steps gives xs 9.005px at 0.563rem, sm 12.00px at 0.750rem, base 16.00px at 1.000rem, md 21.33px at 1.333rem, lg 28.43px at 1.777rem and xl 37.90px at 2.369rem. The property block mirrors those figures exactly, and the note by the CSS label reads "6 steps with a fluid clamp() set". Switching to perfect fifth 1.5 turns the same rows into 7.111, 10.67, 16.00, 24.00, 36.00 and 54.00 pixels.

Ratios, fluid output and the sample line

The menu holds 1.125, 1.2, 1.25, 1.333, 1.414, 1.5, 1.618, 1.667, 1.728 and 1.875, plus Custom, whose box spans 1.05 to 2 and stays synced to the menu. Fluid mode adds a second block of --text-fluid-* properties, taking 85 percent of a step as the minimum and 115 percent as the maximum, interpolated across a 320px to 1280px viewport, so the base row reads clamp(0.850rem, calc(0.750rem + 0.031vw), 1.150rem). Each value reaches its ceiling only on a wide screen and its floor on a narrow one. The sample heading stays hidden until ticked, then shows the largest step capped at 64px.

Where it stops

  • Familiar labels cover exponents -5 to 7; a ten-step scale still fits, but any exponent outside that range falls back to names such as step-6.
  • Perfect fourth is stored as 1.333 rather than 1.3333, so a long scale drifts from the textbook ratio.
  • No line-height, spacing or weight is generated beyond a fixed 1.15 for headings.
  • The trailing body rule assumes var(--text-base) still exists.

Questions people ask

Which ratio should I start with

The page suggests near 1.2 for dense content, 1.333 as a default and above 1.5 only for marketing screens.

Why do the names look like Tailwind

They come from its text scale, which the Tailwind converter can map once a ratio is settled.

Do I need six steps

Two rows either side of the base cover most pages; the font pairing tool picks the faces for them.