Type scale calculator
Pick a base size and a ratio, see every step set in real text, and copy the scale as CSS, fixed or fluid between two screen widths.
How to use it
- Type the base size, usually your body text: 16 px is the browser default.
- Choose a ratio. Small ratios suit dense interfaces; large ones suit editorial pages with big headings.
- Set how many steps go up and down. Tick Fluid to give large screens their own base and ratio.
- Copy the CSS and use
var(--step-0)for body text, higher steps for headings.
How a modular scale works
Each step is the one below multiplied by the ratio. With a 16 px base and a ratio of 1.25, the steps are 16, 20, 25, 31.25, 39.06 px, and so on; down the scale they are 12.8 and 10.24 px. Because every size is related by the same number, headings, body and captions look like one family.
The ratios carry musical names because they are the same proportions as intervals: a perfect fourth is 4:3, a perfect fifth 3:2. The golden ratio, 1.618, gives a steep scale best kept for few steps.
Fluid sizes with clamp()
A fluid scale changes with the width of the screen. Each step gets a minimum size for the narrow screen, a maximum for the wide one, and grows in a straight line between them, written as clamp(min, preferred, max). That way headings can be large on a laptop without overflowing a phone.
Related tools
Questions people ask
What is a type scale?
A set of font sizes built from one base size and one ratio, so every size in a design is related to the others.
Which ratio should I use?
1.125 to 1.2 for interfaces and dashboards, 1.25 to 1.333 for most websites, 1.5 and up for editorial pages with few, large headings.
Why rem instead of px?
rem follows the reader’s browser font size setting, so text grows for people who set a larger default. The CSS here assumes 1 rem = 16 px.
What is a fluid type scale?
A scale whose sizes grow with the viewport between two widths, written with CSS clamp().
Is anything sent to a server?
No. The scale is calculated in your browser.