When you need this tool
Turning a design’s line spacing into CSS, setting up a type scale, or checking that text meets accessibility guidelines. Designers often specify line height in pixels (24 px on 16 px text); developers need the ratio (1.5).
Picking a ratio
- Body text: 1.5 is a safe default. Very long lines (over 75 characters) read better at 1.6.
- Headings: 1.1 to 1.3. Large text with loose leading looks disconnected.
- UI labels and buttons: 1.2 to 1.4, where space is tight.
Baseline grid rounding
Line heights like 22.4 px (14 × 1.6) cause uneven spacing in some browsers and break vertical rhythm. Rounding to the nearest multiple of 4 px (24 px here) keeps everything aligned. The calculator shows the rounded value and the ratio it implies.
Common mistakes
Using px for line-height on components. When a user enlarges text, fixed line heights don’t grow and lines overlap.
Forgetting leading is split. The extra space (line height minus font size) is divided evenly above and below the text, which matters when aligning text to icons.
Related: font size converter and pixels to rem.