Skip to content

Blog

Tailwind line height and letter spacing: every class (v4)

Frank Spin7 min read

Line height in Tailwind is leading-* and letter spacing is tracking-*. This page has both scales with their real values in Tailwind CSS v4, the default line height that every text-* size already carries, the text-lg/7 shorthand, and the size-by-size settings we use for headings in our own themes.

Every value below comes from Tailwind 4.3.3's theme.css, and every class was compiled with that version to check the CSS it produces.

Line height classes#

Tailwind v4 has two kinds of leading-* class. The named ones are ratios of the font size, so they scale with the text:

Classline-heightAt 16px text
leading-none116px
leading-tight1.2520px
leading-snug1.37522px
leading-normal1.524px
leading-relaxed1.62526px
leading-loose232px

The numbered ones are fixed heights on the spacing scale, where each step is 0.25rem (4px): leading-6 is calc(var(--spacing) * 6), so 1.5rem or 24px. In v3 only leading-3 to leading-10 existed; in v4 any number works, including halves like leading-5.5.

Classline-height
leading-41rem (16px)
leading-51.25rem (20px)
leading-61.5rem (24px)
leading-71.75rem (28px)
leading-82rem (32px)
leading-92.25rem (36px)
leading-102.5rem (40px)
leading-123rem (48px)

Use the ratios for headings and anything whose size changes across breakpoints. Use the fixed heights when you need text to sit on a baseline grid, or to match an icon or a button of known height.

For anything else, use an arbitrary value: leading-[1.1], leading-[30px], or a CSS variable with leading-(--my-line-height).

The line height every text size already has#

You often don't need a leading-* class at all. In v4 every text-* size sets its own line height, and the ratio shrinks as the text grows: body text gets room to breathe, headlines stay tight.

ClassFont sizeDefault line height
text-xs12px16px (1.333)
text-sm14px20px (1.429)
text-base16px24px (1.5)
text-lg18px28px (1.556)
text-xl20px28px (1.4)
text-2xl24px32px (1.333)
text-3xl30px36px (1.2)
text-4xl36px40px (1.111)
text-5xl to text-9xl48–128px1

These defaults are good for interface text. They are less good for large headings: text-4xl at 1.111 is fine for one line, but a two-line headline at that size looks loose, and from text-5xl up a line height of exactly 1 can clip descenders on some fonts. That's where the table further down comes in. Our font size cheat sheet lists the sizes in rem as well.

The text-lg/7 shorthand#

You can set size and line height in one class with a slash: text-lg/7 is 18px text on a 28px line, text-sm/relaxed is 14px at 1.625, text-base/[1.6] takes any value. The compiled CSS for text-lg/7:

.text-lg\/7 {
  font-size: var(--text-lg);
  line-height: calc(var(--spacing) * 7);
}

It reads better than two classes and keeps the pair together when you change the size at a breakpoint: text-base/7 md:text-lg/8.

Why leading-* wins over text-* (and when that bites)#

In v4, text-xl doesn't set line-height directly. It sets line-height: var(--tw-leading, var(--text-xl--line-height)), and every leading-* class sets --tw-leading. So a leading-* class always beats the size's default, whatever order you write the classes in.

That's usually what you want, with one trap. leading-tight sticks across breakpoints:

<!-- line height stays 1.25 at every size, including the 14px text on phones -->
<h2 class="text-sm leading-tight md:text-4xl">…</h2>

At 14px, 1.25 is cramped. Either use the shorthand at each breakpoint (text-sm/5 md:text-4xl/tight) or only add the leading-* at the breakpoint where you need it (text-sm md:text-4xl md:leading-tight).

Letter spacing classes#

tracking-* sets letter-spacing, in em, so it scales with the font size:

Classletter-spacingAt 48px text
tracking-tighter-0.05em-2.4px
tracking-tight-0.025em-1.2px
tracking-normal0em0
tracking-wide0.025em1.2px
tracking-wider0.05em2.4px
tracking-widest0.1em4.8px

Arbitrary values work the same as for leading: tracking-[-0.02em], or -tracking-[0.02em] with a leading minus.

The rule of thumb: large text gets tighter, small uppercase text gets wider. Fonts are spaced for reading sizes around 16px; at 48px and up the gaps between letters look too big, and at 12px in capitals the letters crowd each other. Body text should stay at tracking-normal.

Variable fonts with an optical size axis, such as Inter's opsz, already tighten themselves at display sizes. If you use one, start with half the tracking in the table below and check by eye.

Line height and tracking by heading size#

Every website theme on themes.dev uses one table for headings instead of hand-tuning each one. We made it a rule after finding one theme with about twenty different heading line heights between 0.9 and 1.12, which is exactly what makes a template look unfinished. These are the values, as Tailwind classes:

Heading sizeLine heightTrackingClasses
Display, 60px and up1.0-0.03emleading-none tracking-[-0.03em]
40–59px1.04-0.024emleading-[1.04] tracking-[-0.024em]
28–39px1.08-0.018emleading-[1.08] tracking-[-0.018em]
22–27px1.15-0.01emleading-[1.15] tracking-[-0.01em]
Under 22px1.250leading-tight
Big single-line figures (stats, prices)0.9-0.035emleading-[0.9] tracking-[-0.035em]
Kickers and labels, 12–13px uppercasenormal+0.08 to 0.1emtext-xs uppercase tracking-[0.08em]

Two more parts of the same rule: running text in narrow columns (cards, captions) gets leading-normal (1.5), and a page uses two or three running-text sizes, not six. The values are tuned for Geist, the sans-serif our themes use; other fonts are close but check a two-line heading in the real font before you commit.

Put your own values in @theme#

If you use the table above, don't scatter arbitrary values through your markup. Name them in your CSS with @theme, and Tailwind generates the classes:

@import "tailwindcss";

@theme {
  --leading-heading: 1.08;
  --tracking-heading: -0.018em;
  --tracking-kicker: 0.08em;
}

Now leading-heading, tracking-heading and tracking-kicker exist. Better still, give a text size its own line height, letter spacing and weight, so one class sets all four:

@theme {
  --text-display: 4.5rem;
  --text-display--line-height: 1;
  --text-display--letter-spacing: -0.03em;
  --text-display--font-weight: 600;
}

text-display then compiles to font size, line height, letter spacing and weight, each still overridable with leading-*, tracking-* or font-*. If you're moving these values over from a v3 tailwind.config.js, our Tailwind config to v4 converter writes the @theme block for you, and the font size generator builds a fluid type scale with matching line heights.

FAQ#

How do I change line height in Tailwind?

Add a leading-* class: leading-tight (1.25), leading-normal (1.5), leading-relaxed (1.625), a fixed height such as leading-6 (24px), or any value with leading-[1.1]. To set it together with the size, use text-lg/7.

What is the default line height in Tailwind?

It depends on the text size: 1.5 for text-base (24px on 16px), 1.333 for text-xs, down to 1.111 for text-4xl and exactly 1 from text-5xl up. Preflight sets the page itself to 1.5.

What happened to leading-3 to leading-10 in v4?

They still work and give the same values (leading-6 is 24px). In v4 they come from the spacing scale, so every number works, not only 3 to 10.

How do I add letter spacing in Tailwind?

Use tracking-*: tracking-tight (-0.025em) for large headings, tracking-wide (0.025em) or tracking-widest (0.1em) for small uppercase labels, or tracking-[0.08em] for an exact value.

Built on Tailwind CSS v4

1401 finished blocks on shadcn/ui, React and Astro

UI Pro, from €199

Build it with

Preview

Open the page
In UI Pro: get it, €199 once

With every block and theme. 400+ buyers since 2020. Plans

UI Pro

Build your next site from finished blocks

Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.

blocks
1401
page templates
55
website themes
29
The Case study page template from UI Pro, built from its blocks.

This page is built from UI Pro blocks: Zandloper (article-14), Rooilijn (call-to-action-07).