Tailwind CSS Spacing Scale
Complete Tailwind v4 spacing reference.
Base unit: --spacing: 4px
Complete Scale
p-0
0px
p-0.5
2px
p-1
4px
p-1.5
6px
p-2
8px
p-2.5
10px
p-3
12px
p-3.5
14px
p-4
16px
p-5
20px
p-6
24px
p-7
28px
p-8
32px
p-9
36px
p-10
40px
p-11
44px
p-12
48px
p-14
56px
p-16
64px
p-20
80px
p-24
96px
p-28
112px
p-32
128px
p-36
144px
p-40
160px
p-44
176px
p-48
192px
p-52
208px
p-56
224px
p-60
240px
p-64
256px
p-72
288px
p-80
320px
p-96
384px
p-px
1px
Spacing Utilities
Padding
p-*All sidespx-*Horizontal (left & right)py-*Vertical (top & bottom)pt-* pr-* pb-* pl-*Individualps-* pe-*Logical (start/end)Margin
m-*All sidesmx-*Horizontal (left & right)my-*Vertical (top & bottom)mt-* mr-* mb-* ml-*Individualms-* me-*Logical (start/end)Usage Examples
Card Padding
<div class="p-4 md:p-6 lg:p-8"> <!-- 16px → 24px → 32px --> </div>
Button Spacing
<button class="px-4 py-2"> <!-- 16px horizontal, 8px vertical --> </button>
Stack Spacing
<div class="space-y-4"> <!-- 16px gap between children --> </div>
Grid Gap
<div class="grid gap-6"> <!-- 24px gap between items --> </div>
About Tailwind Spacing
Tailwind v4 uses a simple formula: calc(var(--spacing) * n) where --spacing: 4px by default.
So p-4 = 4 × 4px = 16px, and m-8 = 8 × 4px = 32px.
For arbitrary values, use bracket notation: p-[17px] or m-[2.5rem]
Explore more Tailwind tools
Tailwind Grid Generator
Create grid layouts visually
Tailwind Flexbox Generator
Create flex layouts visually
Tailwind Gradient Generator
Create custom gradients
Aa
Tailwind Text Gradient
Gradient text effects
Tailwind Gradients Collection
275+ ready-to-use gradients
Tailwind Colors
Complete 240+ color palette
Tailwind Box Shadow Generator
Design multi-layer shadows
Aa
Tailwind Text Shadow
Add depth to text with shadows
Tailwind Filter Generator
Apply blur, brightness & more
Tailwind Transform Generator
Rotate, scale & translate elements
Tailwind Animation Generator
Create built-in & custom animations
Tailwind Transition Generator
Smooth hover transitions
Tailwind Config Generator
Generate your config file
Tailwind Input Generator
Design form inputs visually
Tailwind Class Sorter
Organize classes in order
Flexbox Cheatsheet
All flex utilities visualized
Overflow Cheatsheet
Control content overflow
