PureDevTools

Tailwind CSS Spacing Reference

Every Tailwind spacing, sizing, and typography utility — class name, CSS value, and px equivalent. Search and click to copy.

All processing happens in your browser. No data is sent to any server.
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes
line-height: 1rem (16px)
line-height: 1.25rem (20px)
line-height: 1.5rem (24px)
line-height: 1.75rem (28px)
line-height: 1.75rem (28px)
line-height: 2rem (32px)
line-height: 2.25rem (36px)
line-height: 2.5rem (40px)
line-height: 1
line-height: 1
line-height: 1
line-height: 1
line-height: 1
ClassCSS ValuepxNotes
ClassCSS ValuepxNotes

Notes

  • All values based on Tailwind CSS v3 defaults (base font size = 16px).
  • Click any class name, CSS value, or px value to copy it.
  • The spacing scale applies to p-*, m-*, and gap-* utilities simultaneously.
  • Width and height utilities also accept the full spacing scale plus fractional and keyword values.

You’re writing p-6 and need to know: is that 24px or 1.5rem? What about w-72 — is that 18rem or 288px? The Tailwind docs spread spacing values across padding, margin, width, height, and gap pages. You need one searchable table that maps every class name to its CSS value and pixel equivalent.

Why This Reference (Not the Tailwind Docs)

The Tailwind docs list spacing values across separate utility pages. This tool puts all spacing, sizing, and typography values on one searchable page — class name → CSS value → px equivalent. Search for 6 and see p-6 = 1.5rem = 24px, m-6 = 1.5rem = 24px, w-6 = 1.5rem = 24px all at once. Everything runs in your browser.

What Is This Tool?

The Tailwind CSS Spacing Reference is a searchable cheat sheet covering every spacing, sizing, and typography utility in the Tailwind CSS v3 default configuration. Instead of digging through documentation, you can search for a class name like p-4, a value like 1rem, or a pixel size like 16px — and instantly see the matching Tailwind class plus its full CSS value.

Click any class name, CSS value, or px equivalent to copy it to your clipboard.

The Tailwind Default Spacing Scale

Tailwind’s core spacing scale is used across p-* (padding), m-* (margin), gap-* (flex/grid gap), w-* (width), h-* (height), and many other utilities. The scale is based on 0.25rem units at a 16px base font size:

Class suffixCSS valuepx equivalent
00px0px
px1px1px
0.50.125rem2px
10.25rem4px
20.5rem8px
41rem16px
82rem32px
123rem48px
164rem64px
246rem96px
328rem128px
4812rem192px
6416rem256px
9624rem384px

The full table in the tool above includes all 35 spacing steps from 0 through 96.

rem to px Conversion

Tailwind assumes a base font size of 16px (the browser default). The conversion formula is:

px = rem × 16

So p-4 = 1rem = 1 × 16 = 16px. If you change the browser’s root font size (or set font-size on the html element), all rem-based values scale proportionally.

Width and Height Utilities

In addition to the spacing scale, w-* and h-* utilities include:

Fractional Widths

ClassCSS value
w-1/250%
w-1/333.333333%
w-2/366.666667%
w-1/425%
w-3/475%
w-1/6 through w-5/616.666667% — 83.333333%
w-1/12 through w-11/128.333333% — 91.666667%

Keyword Widths and Heights

ClassCSS valueDescription
w-auto / h-autoautoBrowser-determined size
w-full / h-full100%Full parent size
w-screen100vwFull viewport width
h-screen100vhFull viewport height
w-dvw / h-dvh100dvw / 100dvhDynamic viewport (iOS scroll-safe)
w-svw / h-svh100svw / 100svhSmall viewport (iOS toolbar excluded)
w-min / h-minmin-contentShrinks to smallest content size
w-max / h-maxmax-contentGrows to largest content size
w-fit / h-fitfit-contentFits content up to available space

Tip: Use h-dvh instead of h-screen for mobile layouts — dvh accounts for dynamic browser chrome (address bar appearing/disappearing on scroll).

Max-Width Named Scale

The max-w-* utilities include a named scale designed for common container widths:

ClassCSS valuepx
max-w-xs20rem320px
max-w-sm24rem384px
max-w-md28rem448px
max-w-lg32rem512px
max-w-xl36rem576px
max-w-2xl42rem672px
max-w-3xl48rem768px
max-w-4xl56rem896px
max-w-5xl64rem1024px
max-w-6xl72rem1152px
max-w-7xl80rem1280px
max-w-prose65ch~65 characters wide
max-w-screen-sm640pxTailwind sm breakpoint
max-w-screen-md768pxTailwind md breakpoint
max-w-screen-lg1024pxTailwind lg breakpoint
max-w-screen-xl1280pxTailwind xl breakpoint
max-w-screen-2xl1536pxTailwind 2xl breakpoint

max-w-prose (65ch) is particularly useful for article text — it limits line length to roughly 65 characters, which improves readability according to typography research.

Border Radius

ClassCSS valuepx
rounded-none0px0px
rounded-sm0.125rem2px
rounded0.25rem4px
rounded-md0.375rem6px
rounded-lg0.5rem8px
rounded-xl0.75rem12px
rounded-2xl1rem16px
rounded-3xl1.5rem24px
rounded-full9999pxCircle/pill

Common patterns:

Font Size and Line Height

Tailwind’s text-* utilities set both font-size and a default line-height:

Classfont-sizeline-heightpx size
text-xs0.75rem1rem12px
text-sm0.875rem1.25rem14px
text-base1rem1.5rem16px
text-lg1.125rem1.75rem18px
text-xl1.25rem1.75rem20px
text-2xl1.5rem2rem24px
text-3xl1.875rem2.25rem30px
text-4xl2.25rem2.5rem36px
text-5xl3rem148px
text-6xl3.75rem160px
text-7xl4.5rem172px
text-8xl6rem196px
text-9xl8rem1128px

Note: At 5xl and above, Tailwind sets line-height: 1 (tight) because display-size headings typically need custom leading.

Letter Spacing

ClassCSS valueEffect
tracking-tighter-0.05emVery condensed
tracking-tight-0.025emSlightly condensed
tracking-normal0emDefault browser spacing
tracking-wide0.025emSlightly expanded
tracking-wider0.05emMore expanded
tracking-widest0.1emMaximum expansion

Typography tips:

Line Height Utilities

leading-* controls line-height independently of font-size:

ClassCSS valueDescription
leading-none1No extra space — tight headings
leading-tight1.25Compact headings
leading-snug1.375Comfortable headings
leading-normal1.5Default body text
leading-relaxed1.625Comfortable long-form reading
leading-loose2Very open — for dense UI
leading-3 through leading-100.75rem–2.5remFixed rem values

Readability rule of thumb: Body text at leading-relaxed (1.625) or leading-normal (1.5) improves reading speed for paragraphs. Headlines at leading-none or leading-tight look more intentional.

Using This Reference in Practice

When building a component:

  1. Use the spacing scale for consistent padding and margin — p-4, p-6, px-3 py-2
  2. Use named max-widths for container width — max-w-4xl mx-auto
  3. Use fractional widths for column layouts — w-1/2, w-1/3
  4. Use rounded-lg as the default card radius; rounded-full for avatars

Memorizing the scale:

Frequently Asked Questions

What does p-4 equal in pixels? p-4 = 1rem = 16px at the default 16px base font size. It sets padding: 1rem on all four sides.

How do I set different padding on each side? Use directional utilities: pt-* (top), pb-* (bottom), pl-* (left), pr-* (right), px-* (horizontal = left + right), py-* (vertical = top + bottom). For example, px-6 py-3 is common for buttons.

What is the difference between w-full and w-screen? w-full = 100% of the parent container. w-screen = 100vw (viewport width). If your container has padding, w-full respects it, while w-screen ignores it and spans the full window. To create a full-bleed section inside a padded container, you often need w-screen -mx-4 or similar negative margin tricks.

Which Tailwind class equals exactly 24px? p-6, w-6, h-6, gap-6, m-6 — all of them apply 1.5rem = 24px from the spacing scale. Search “24px” or “1.5rem” in the tool above to see all matching classes.

How does line-height interact with font-size in Tailwind? Tailwind’s text-* utilities set both font-size and a default line-height together. You can override line-height independently with leading-*. For example, text-lg leading-tight sets font-size: 1.125rem with line-height: 1.25 instead of the default 1.75rem.

What is max-w-prose used for? max-w-prose sets max-width: 65ch, limiting a text container to approximately 65 characters wide. This is the typographic sweet spot for comfortable reading — wide enough for natural line breaks but narrow enough to prevent eye strain from tracking across long lines.

Related Tools

More CSS Tools