Tailwind CSS Spacing Reference
Every Tailwind spacing, sizing, and typography utility — class name, CSS value, and px equivalent. Search and click to copy.
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | — | ||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | |||
| — | |||
| — | |||
| — | |||
| — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| 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 |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | |||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — |
| Class | CSS Value | px | Notes |
|---|---|---|---|
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — | ||
| — | — |
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-*, andgap-*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 suffix | CSS value | px equivalent |
|---|---|---|
| 0 | 0px | 0px |
| px | 1px | 1px |
| 0.5 | 0.125rem | 2px |
| 1 | 0.25rem | 4px |
| 2 | 0.5rem | 8px |
| 4 | 1rem | 16px |
| 8 | 2rem | 32px |
| 12 | 3rem | 48px |
| 16 | 4rem | 64px |
| 24 | 6rem | 96px |
| 32 | 8rem | 128px |
| 48 | 12rem | 192px |
| 64 | 16rem | 256px |
| 96 | 24rem | 384px |
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
| Class | CSS value |
|---|---|
w-1/2 | 50% |
w-1/3 | 33.333333% |
w-2/3 | 66.666667% |
w-1/4 | 25% |
w-3/4 | 75% |
w-1/6 through w-5/6 | 16.666667% — 83.333333% |
w-1/12 through w-11/12 | 8.333333% — 91.666667% |
Keyword Widths and Heights
| Class | CSS value | Description |
|---|---|---|
w-auto / h-auto | auto | Browser-determined size |
w-full / h-full | 100% | Full parent size |
w-screen | 100vw | Full viewport width |
h-screen | 100vh | Full viewport height |
w-dvw / h-dvh | 100dvw / 100dvh | Dynamic viewport (iOS scroll-safe) |
w-svw / h-svh | 100svw / 100svh | Small viewport (iOS toolbar excluded) |
w-min / h-min | min-content | Shrinks to smallest content size |
w-max / h-max | max-content | Grows to largest content size |
w-fit / h-fit | fit-content | Fits 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:
| Class | CSS value | px |
|---|---|---|
max-w-xs | 20rem | 320px |
max-w-sm | 24rem | 384px |
max-w-md | 28rem | 448px |
max-w-lg | 32rem | 512px |
max-w-xl | 36rem | 576px |
max-w-2xl | 42rem | 672px |
max-w-3xl | 48rem | 768px |
max-w-4xl | 56rem | 896px |
max-w-5xl | 64rem | 1024px |
max-w-6xl | 72rem | 1152px |
max-w-7xl | 80rem | 1280px |
max-w-prose | 65ch | ~65 characters wide |
max-w-screen-sm | 640px | Tailwind sm breakpoint |
max-w-screen-md | 768px | Tailwind md breakpoint |
max-w-screen-lg | 1024px | Tailwind lg breakpoint |
max-w-screen-xl | 1280px | Tailwind xl breakpoint |
max-w-screen-2xl | 1536px | Tailwind 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
| Class | CSS value | px |
|---|---|---|
rounded-none | 0px | 0px |
rounded-sm | 0.125rem | 2px |
rounded | 0.25rem | 4px |
rounded-md | 0.375rem | 6px |
rounded-lg | 0.5rem | 8px |
rounded-xl | 0.75rem | 12px |
rounded-2xl | 1rem | 16px |
rounded-3xl | 1.5rem | 24px |
rounded-full | 9999px | Circle/pill |
Common patterns:
- Cards and panels:
rounded-lgorrounded-xl - Buttons:
rounded-mdorrounded-lg - Avatars and icons:
rounded-full - Input fields:
rounded-lgwithborder
Font Size and Line Height
Tailwind’s text-* utilities set both font-size and a default line-height:
| Class | font-size | line-height | px size |
|---|---|---|---|
text-xs | 0.75rem | 1rem | 12px |
text-sm | 0.875rem | 1.25rem | 14px |
text-base | 1rem | 1.5rem | 16px |
text-lg | 1.125rem | 1.75rem | 18px |
text-xl | 1.25rem | 1.75rem | 20px |
text-2xl | 1.5rem | 2rem | 24px |
text-3xl | 1.875rem | 2.25rem | 30px |
text-4xl | 2.25rem | 2.5rem | 36px |
text-5xl | 3rem | 1 | 48px |
text-6xl | 3.75rem | 1 | 60px |
text-7xl | 4.5rem | 1 | 72px |
text-8xl | 6rem | 1 | 96px |
text-9xl | 8rem | 1 | 128px |
Note: At 5xl and above, Tailwind sets line-height: 1 (tight) because display-size headings typically need custom leading.
Letter Spacing
| Class | CSS value | Effect |
|---|---|---|
tracking-tighter | -0.05em | Very condensed |
tracking-tight | -0.025em | Slightly condensed |
tracking-normal | 0em | Default browser spacing |
tracking-wide | 0.025em | Slightly expanded |
tracking-wider | 0.05em | More expanded |
tracking-widest | 0.1em | Maximum expansion |
Typography tips:
- Headlines at large sizes:
tracking-tightortracking-tighter— large type looks too spaced-out at defaults - Uppercase labels and badges:
tracking-wideortracking-wider— improves readability of ALL CAPS text - Body copy:
tracking-normal— don’t change what you don’t need to
Line Height Utilities
leading-* controls line-height independently of font-size:
| Class | CSS value | Description |
|---|---|---|
leading-none | 1 | No extra space — tight headings |
leading-tight | 1.25 | Compact headings |
leading-snug | 1.375 | Comfortable headings |
leading-normal | 1.5 | Default body text |
leading-relaxed | 1.625 | Comfortable long-form reading |
leading-loose | 2 | Very open — for dense UI |
leading-3 through leading-10 | 0.75rem–2.5rem | Fixed 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:
- Use the spacing scale for consistent padding and margin —
p-4,p-6,px-3 py-2 - Use named max-widths for container width —
max-w-4xl mx-auto - Use fractional widths for column layouts —
w-1/2,w-1/3 - Use
rounded-lgas the default card radius;rounded-fullfor avatars
Memorizing the scale:
p-1 = 4px,p-2 = 8px,p-4 = 16px,p-8 = 32px— double each stepp-4is your base unit — think of it as “one spacing step”- Padding inside buttons is typically
px-4 py-2(horizontal larger than vertical)
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.