Home/Tools/Typography/Line Height Tool
Typography · Generator

Line Height Tool

Calculate optimal line heights for better readability.

Font Size

16px

Line Height

1.5

Computed Values

Line height: 1.5

Computed: 24px

Preview

The quick brown fox jumps over the lazy dog. This is a sample paragraph to demonstrate line height. Good line height improves readability and makes text easier to scan. The ideal line height depends on the font size, font family, and line length.

Line Height Guide

1.0 - 1.2
Headings, single lines
1.4 - 1.6
Body text (recommended)
1.8 - 2.0
Long-form content, accessibility
Generated CSS
font-size: 16px;
line-height: 1.5;

/* Computed line-height: 24px */
100%
Free, no
sign-up needed
0
Code written
by hand
85+
CSS tools
in one place
<1s
Copy-ready
CSS instantly
What is this

What is the CSS Line Height Tool?

Preview and generate the right line-height value for your text. See live how different values affect readability at various font sizes.

Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.

How to use

Using the CSS Line Height Tool

Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.

1

Set font size and sample text

Enter your target font size and type or paste sample paragraph text into the preview area.

2

Adjust line-height with the slider

Drag the slider between 1.0 and 2.5. The preview updates in real time, showing how the line spacing affects readability.

3

Copy the CSS value

Click Copy to grab the line-height value. Use the unitless number form for best results.

The output

What the generated code looks like

Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.

styles.css
/* Unitless multiplier (recommended) */
body       { line-height: 1.6; }   /* comfortable for body text */
h1, h2, h3 { line-height: 1.2; }   /* tighter for headings */
code, pre  { line-height: 1.8; }   /* extra space for code blocks */

/* Avoid px - it does not scale with font size */
/* Bad: */  p { line-height: 24px; }
/* Good: */ p { line-height: 1.6; }

Unitless values are relative to the element font-size and inherited correctly. px line-height does not scale when the font size changes.

Pro tips

Pro tips for better results

Body text reads best at 1.5-1.7

WCAG 1.4.8 recommends a line spacing of at least 1.5 times the font size for body text. Values between 1.5 and 1.7 work well for most typefaces at 16-18px.

Tighten line-height for large headings

Display headings at 48px or larger look best at line-height: 1.1 to 1.2. Loose line-height on large type makes headings feel like separate lines rather than a unit.

Use unitless values for correct inheritance

line-height: 1.6 on body means all child elements compute their own line-height as 1.6 x their font-size. line-height: 24px is inherited as a fixed 24px regardless of the child font-size - which causes compressed text at small sizes.

Code blocks need more line-height than prose

Dense code at 1.6 line-height can be hard to scan. 1.8 or 2.0 makes it easier to see which line is which, especially in long functions.

FAQ

Frequently asked questions

Between 1.5 and 1.7 for most body typefaces at 16-18px. Wider typefaces or larger text can use 1.4. Narrow or condensed typefaces may need 1.8. Test with a paragraph of actual content, not placeholder text.
Always use unitless values. A unitless line-height is a multiplier of the current font-size and is inherited as a multiplier, not a fixed value. px line-height is inherited as a fixed pixel value, which causes tight or overflowing text when nested elements have different font sizes.
No. Everything runs in your browser. Nothing is sent to a server.

From the blog

Read more