Typography Scale Calculator
Generate a modular type scale in px and rem, with CSS.
Inputs
Example0 to 10.
0 to 5.
Usually 16.
Result
- Largest size
- 48.83 px (3.0518 rem)
- Smallest size
- 10.24 px (0.64 rem)
- Sizes
- 8
Some sizes are below 12 px, which many people find hard to read.
| Step | px | rem |
|---|---|---|
| up-5 | 48.83 | 3.0518 |
| up-4 | 39.06 | 2.4414 |
| up-3 | 31.25 | 1.9531 |
| up-2 | 25 | 1.5625 |
| up-1 | 20 | 1.25 |
| base | 16 | 1 |
| down-1 | 12.8 | 0.8 |
| down-2 | 10.24 | 0.64 |
About this tool
A modular type scale multiplies a base size by the same ratio at each step, so headings and body text relate to each other consistently. Choose a base size and a ratio, and get every size in pixels and rem, ready to paste as CSS custom properties.
- Enter your body text size.
- Choose a ratio: smaller ratios suit dense interfaces, larger ones suit editorial pages.
- Choose how many steps to generate, then copy the CSS.
Formula
Size at step n = base × ratio^n, for n from −(steps below) to +(steps above). rem = size ÷ root font size.
Worked example
With a 16 px base and a 1.25 ratio, step 2 is 16 × 1.25² = 25 px (1.5625 rem) and step −1 is 16 ÷ 1.25 = 12.8 px.
Assumptions and limits
- Sizes are rounded to two decimals in px and four in rem.
- Very small steps below base may be too small to read; keep body text at 16 px or above for most screens.
- Line height and spacing are not set.
Questions
Which ratio should I use?
1.2 to 1.25 suits most websites and apps. 1.333 and above give dramatic headings for marketing and editorial pages.
Why use rem?
rem sizes follow the reader's browser font-size setting, which helps people who need larger text.
Should mobile use a smaller ratio?
Often yes. Large ratios make top-level headings very big on small screens.