How to Calculate Line Height for Web Typography
Line height (leading) is the vertical space between lines of text. Too tight and text feels cramped and hard to read. Too loose and lines disconnect from each other. The right line height depends on font size, line length, and font characteristics โ and there's a reliable formula to find it.
- Set the perfect line-height for readable web text.
- The Line Height Formula.
- Covers headings vs body text.
- Covers use unitless line-height.
- Covers font-specific considerations.
The Line Height Formula
For body text, use a line-height between 1.4 and 1.8 times the font size. The optimal value depends on line length: shorter lines (40-50 characters) need tighter line height (1.4-1.5). Longer lines (70-80 characters) need looser line height (1.6-1.8). For a 16px body font at 65 characters per line, 1.6 (25.6px) is a good starting point.
Headings vs Body Text
Headings need tighter line height than body text because they're larger and typically shorter (1-3 lines). Use 1.1-1.3 for headings. Body text uses 1.4-1.8. Subheadings and UI labels use 1.2-1.4. The Line Height Calculator generates values for each text role based on your font size and reading context.
Use Unitless Line-Height
Always use unitless line-height values: line-height: 1.5 (not line-height: 24px or line-height: 1.5em). Unitless values scale with the element's font size โ if a child element changes font size, the line height adjusts proportionally. Fixed values (px, em) inherit the computed value, which breaks when font sizes change.
background-size animation or @property registered custom properties instead.Font-Specific Considerations
Fonts with tall x-heights (the height of lowercase letters) need more line height because the text feels denser. Fonts with large ascenders/descenders (letters like b, d, g, p) may need extra line height to prevent overlap. Always test line height visually with your actual font โ two fonts at the same size can feel very different.
Frequently Asked Questions
What is the ideal line height for body text?
Should I use px or unitless values for line-height?
What line height should headings use?
Use the Line Height Calculator โ free, no signup required.
โก Open Line Height Calculator