Picking font sizes by eye leads to headings that do not quite fit together. A type scale calculator builds a modular scale from a base font size and a ratio, and gives nine sizes from small print to display text, from step −2 to step +6, so that every size relates to the others.
How the calculation works
- A modular scale multiplies a base size by the same ratio at each step. The size at step n = base × ratio^n, where n is negative for sizes below the base.
- Common ratios come from music: 1.125 major second, 1.2 minor third, 1.25 major third, 1.333 perfect fourth, 1.414 augmented fourth, 1.5 perfect fifth and 1.618 the golden ratio.
- A small ratio gives a quiet scale for dense interfaces, and a large one gives strong contrast between headings and text, which suits editorial pages.
- The output lists 9 steps, from −2 to +6, in pixels. Divide by the root size to get rem values.
Example
With a base of 16 px and a ratio of 1.25, step 1 is 16 × 1.25 = 20 px, step 2 is 16 × 1.25² = 25 px, step 3 is 31.25 px, step 4 is 39.06 px and step 5 is 48.83 px. Below the base, step −1 is 16 ÷ 1.25 = 12.8 px and step −2 is 10.24 px.
Why it matters
A consistent scale makes a page look planned and makes it easier to maintain, since every new heading uses a size that already exists. It is a quick start for a design system, a blog theme or a slide deck.
Good to know
A scale gives sizes and not line heights or spacing, which should also follow a rhythm, for instance a line height of 1.5 for text and 1.2 for headings. Check the result on real content and on a small screen, since the largest steps can be too big for a phone. Round the values if you prefer whole pixels, but keep the ratio in mind.
Related tools
The golden ratio calculator gives the ratio of 1.618 for proportions and the aspect ratio calculator keeps the shape of images and screens.