Line height calculator
Find the right line height for any font, size and column width. Convert between unitless, px, %, em and rem, see a live preview with real fonts, check it against readability and accessibility guidelines, and copy the code for CSS, Tailwind or Figma.
How to use the line height calculator
- Pick your font and size. Choose a system font or any Google Font, then enter the size in px, rem or pt.
- Set the line height and text width. Use the slider, or type a value in any unit: unitless, px, %, em or rem. The text width is how wide your column of text is.
- Check the results. You get the line height in every unit, a recommended value for your size and width, the characters per line and a set of readability checks.
- Copy the code. Choose CSS, Tailwind, SCSS or Figma values and copy them straight into your project.
What is line height?
Line height is the distance from one line of text to the next. In CSS it sets the height of each line box, and the extra space is split evenly above and below the letters. Printers call the same idea leading, after the strips of lead that were placed between lines of metal type.
If your font size is 16px and your line height is 1.5, each line takes up 24px. That leaves 8px of space between lines: 4px above the text and 4px below.
How to calculate line height
The maths is simple once you know which unit you are using:
- Unitless: line box = font size × value. 16px × 1.5 = 24px.
- Percent: line box = font size × percent ÷ 100. 150% of 16px = 24px.
- em: works like unitless for the element itself. 1.5em at 16px = 24px.
- rem: line box = value × the root font size (usually 16px). 1.5rem = 24px, whatever the text size.
- px: the line box is exactly that number, whatever the font size.
To go the other way, divide the line box by the font size. A 28px line box with 20px text is 28 ÷ 20 = 1.4.
Unitless, px, em or %: which should you use?
For most websites, unitless is best. A unitless line height is passed down to child elements as a ratio, so a heading or a small caption inside a paragraph keeps sensible spacing for its own size.
With px, em or %, the browser works out a fixed pixel value on the parent and passes that number down. A 48px heading inside a block set to line-height: 24px or 1.5em at 16px will get 24px lines, and the lines will overlap. Use px when you need to match an exact design spec or a baseline grid, and check any larger text inside it.
Figma shows line height as a percentage or in px. 150% in Figma is the same as line-height: 1.5 in CSS.
Recommended line heights
| Text | Typical line height | Why |
|---|---|---|
| Body text and articles | 1.5 to 1.7 | Gives the eye room to find the next line in long paragraphs. |
| UI text, cards and forms | 1.4 to 1.5 | Short lines need a little less spacing. |
| Subheadings (20–32px) | 1.25 to 1.4 | Bigger text already has more space around it. |
| Large headings (32px+) | 1.05 to 1.25 | Loose spacing makes big headings look like separate lines. |
| Buttons and labels | 1 to 1.25 | Usually a single line, so the spacing only affects height. |
| Code blocks | 1.4 to 1.6 | Helps when scanning lines of code. |
The calculator’s recommendation uses golden ratio typography for body text. That method allows for both font size and line width, because longer lines need a bit more spacing to stay easy to follow. For headings it switches to a tighter rule based on size.
Line height and line length
Line height and line length work together. Most readers are comfortable with 45 to 75 characters per line, and the WCAG accessibility guidelines suggest no more than 80. When a line is long, the eye has further to travel back to the start of the next one, so extra line height helps. With short lines, such as on mobile, you can use a little less.
The calculator measures the average character width of your chosen font, so the characters per line figure reflects the actual typeface rather than a rough guess.
Line height and accessibility (WCAG)
- WCAG 1.4.8 Visual Presentation (AAA) asks for line spacing of at least 1.5 within paragraphs, lines of no more than 80 characters and text that isn’t justified.
- WCAG 1.4.12 Text Spacing (AA) says content must still work when a reader increases spacing themselves: line height 1.5, paragraph spacing 2 × the font size, letter spacing 0.12em and word spacing 0.16em. Tick WCAG text spacing test under the preview to see your text with these settings.
Fixed-height boxes are the usual problem. If a card or button has a set height, the bigger spacing can make text spill out or get cut off. Using min-height instead of height usually fixes it.
Build a whole type scale
Switch to the Type scale tab to create font sizes for H1 to H6, body and small text from one ratio, such as the major third (1.25) or perfect fourth (1.333). Each size gets its own line height: headings receive the same extra space as body text, so they end up tighter as they get bigger.
Tick Fluid sizes to get CSS clamp() values that grow smoothly from mobile to desktop, then copy the result as CSS variables, a Tailwind v4 @theme block or a Tailwind v3 config.
Frequently asked questions
What is a good line height for body text?
Around 1.5 to 1.6 suits most body text on screen. Go a little higher for long lines or fonts with a large x-height, and a little lower for narrow columns.
Is line-height: 1.5 the same as 150%?
For the element itself, yes: both give a line box 1.5 times the font size. The difference is inheritance. Child elements inherit 1.5 as a ratio, but they inherit 150% as a fixed pixel value worked out from the parent’s font size.
What is the default line height in CSS?
The default is normal, which browsers set to roughly 1.2, depending on the font. That is usually too tight for paragraphs, which is why most sites set their own.
How do I convert line height from Figma to CSS?
Divide Figma’s percentage by 100 to get a unitless CSS value: 140% becomes line-height: 1.4. If Figma shows px, divide it by the font size. The Figma option in the calculator gives you both.
What is the difference between line height and leading?
They describe the same thing. Leading comes from print and is usually written as font size over line height, such as 12/18 pt. In CSS, the extra space is split above and below each line rather than added only below it.
Does this work for Tailwind CSS?
Yes. The Tailwind option uses the built-in classes when your values match them, like leading-relaxed for 1.625, and arbitrary values like leading-[1.55] when they don’t. The Type scale tab also exports a Tailwind theme.