Tailwind CSS v4 Cheat Sheet (Searchable) | How-to Guide
A searchable Tailwind CSS v4 cheat sheet: type any class or plain word and see the exact CSS v4 generates, from var(--spacing) multiples to OKLCH color tokens. It also covers @theme tokens, breakpoints, container queries, live flex and grid boxes, the full color palette, dark mode, and v3 to v4 renames.
This sheet covers Tailwind CSS v4 (v4.3 is the current release at the time of writing, October 2026). For each class it shows the CSS that v4 actually writes, which matters because v4 changed how values are produced: spacing is a multiple of one --spacing variable, colors are --color-* variables defined in OKLCH, and sizes such as radius, shadow and text come from named theme variables. Type in the box to filter. Search works on class names, the CSS they output, and plain words such as "center", "gradient" or "sticky".
Search every utility
Showing all 243
| Class | CSS it outputs in v4 |
|---|---|
| Layout and display | |
block | display: block; |
inline-block | display: inline-block; |
inline | display: inline; |
flex | display: flex; |
inline-flex | display: inline-flex; |
grid | display: grid; |
inline-grid | display: inline-grid; |
contents | display: contents; |
hidden | display: none; |
container | width: 100%; plus max-width: var(--breakpoint-sm) at sm, and so on for each breakpoint |
box-border | box-sizing: border-box; |
box-content | box-sizing: content-box; |
static | position: static; |
relative | position: relative; |
absolute | position: absolute; |
fixed | position: fixed; |
sticky | position: sticky; |
inset-0 | inset: calc(var(--spacing) * 0); |
inset-x-0 | inset-inline: calc(var(--spacing) * 0); |
top-4 | top: calc(var(--spacing) * 4); /* 1rem */ |
-top-2 | top: calc(var(--spacing) * -2); |
left-1/2 | left: calc(1/2 * 100%); |
z-10 | z-index: 10; |
z-50 | z-index: 50; |
isolate | isolation: isolate; |
overflow-hidden | overflow: hidden; |
overflow-auto | overflow: auto; |
overflow-x-auto | overflow-x: auto; |
aspect-video | aspect-ratio: var(--aspect-video); /* 16 / 9 */ |
aspect-square | aspect-ratio: 1 / 1; |
object-cover | object-fit: cover; |
object-contain | object-fit: contain; |
visible | visibility: visible; |
invisible | visibility: hidden; |
sr-only | position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border-width: 0; |
| Flexbox | |
flex-row | flex-direction: row; |
flex-col | flex-direction: column; |
flex-row-reverse | flex-direction: row-reverse; |
flex-wrap | flex-wrap: wrap; |
flex-nowrap | flex-wrap: nowrap; |
flex-1 | flex: 1; |
flex-auto | flex: auto; |
flex-initial | flex: 0 auto; |
flex-none | flex: none; |
grow | flex-grow: 1; |
grow-0 | flex-grow: 0; |
shrink-0 | flex-shrink: 0; |
basis-64 | flex-basis: calc(var(--spacing) * 64); |
basis-1/3 | flex-basis: calc(1/3 * 100%); |
order-2 | order: 2; |
order-first | order: -9999; |
order-last | order: 9999; |
| Alignment and gap | |
justify-start | justify-content: flex-start; |
justify-center | justify-content: center; |
justify-end | justify-content: flex-end; |
justify-between | justify-content: space-between; |
justify-around | justify-content: space-around; |
justify-evenly | justify-content: space-evenly; |
items-start | align-items: flex-start; |
items-center | align-items: center; |
items-end | align-items: flex-end; |
items-baseline | align-items: baseline; |
items-stretch | align-items: stretch; |
self-center | align-self: center; |
self-end | align-self: flex-end; |
content-center | align-content: center; |
place-items-center | place-items: center; |
place-content-center | place-content: center; |
justify-items-center | justify-items: center; |
gap-4 | gap: calc(var(--spacing) * 4); /* 1rem */ |
gap-x-6 | column-gap: calc(var(--spacing) * 6); |
gap-y-2 | row-gap: calc(var(--spacing) * 2); |
| Grid | |
grid-cols-3 | grid-template-columns: repeat(3, minmax(0, 1fr)); |
grid-cols-12 | grid-template-columns: repeat(12, minmax(0, 1fr)); |
grid-cols-[200px_1fr] | grid-template-columns: 200px 1fr; |
grid-cols-subgrid | grid-template-columns: subgrid; |
grid-rows-3 | grid-template-rows: repeat(3, minmax(0, 1fr)); |
col-span-2 | grid-column: span 2 / span 2; |
col-span-full | grid-column: 1 / -1; |
col-start-2 | grid-column-start: 2; |
row-span-2 | grid-row: span 2 / span 2; |
grid-flow-col | grid-auto-flow: column; |
grid-flow-dense | grid-auto-flow: dense; |
auto-rows-fr | grid-auto-rows: minmax(0, 1fr); |
auto-cols-max | grid-auto-columns: max-content; |
| Spacing | |
p-4 | padding: calc(var(--spacing) * 4); /* 1rem */ |
p-px | padding: 1px; |
p-[13px] | padding: 13px; |
p-(--card-pad) | padding: var(--card-pad); |
px-6 | padding-inline: calc(var(--spacing) * 6); |
py-2 | padding-block: calc(var(--spacing) * 2); |
pt-8 | padding-top: calc(var(--spacing) * 8); |
ps-4 | padding-inline-start: calc(var(--spacing) * 4); |
m-0 | margin: calc(var(--spacing) * 0); |
mx-auto | margin-inline: auto; |
mt-6 | margin-top: calc(var(--spacing) * 6); |
-mt-2 | margin-top: calc(var(--spacing) * -2); |
ms-auto | margin-inline-start: auto; |
space-y-4 | margin-block-end: calc(var(--spacing) * 4) on every child except the last (selector: > :not(:last-child)) |
space-x-2 | margin-inline-end: calc(var(--spacing) * 2) on every child except the last |
| Sizing | |
w-64 | width: calc(var(--spacing) * 64); /* 16rem */ |
w-full | width: 100%; |
w-1/2 | width: calc(1/2 * 100%); |
w-screen | width: 100vw; |
w-fit | width: fit-content; |
w-auto | width: auto; |
size-10 | width: calc(var(--spacing) * 10); height: calc(var(--spacing) * 10); |
h-12 | height: calc(var(--spacing) * 12); |
h-dvh | height: 100dvh; |
h-screen | height: 100vh; |
min-h-screen | min-height: 100vh; |
min-w-0 | min-width: calc(var(--spacing) * 0); |
max-w-md | max-width: var(--container-md); /* 28rem */ |
max-w-7xl | max-width: var(--container-7xl); /* 80rem */ |
max-w-prose | max-width: 65ch; |
max-w-screen-lg | max-width: var(--breakpoint-lg); |
| Typography | |
text-xs | font-size: var(--text-xs); /* 0.75rem */ line-height: var(--tw-leading, var(--text-xs--line-height)); |
text-sm | font-size: var(--text-sm); /* 0.875rem */ line-height: var(--tw-leading, var(--text-sm--line-height)); |
text-base | font-size: var(--text-base); /* 1rem */ line-height: var(--tw-leading, var(--text-base--line-height)); |
text-xl | font-size: var(--text-xl); /* 1.25rem */ line-height: var(--tw-leading, var(--text-xl--line-height)); |
text-4xl | font-size: var(--text-4xl); /* 2.25rem */ line-height: var(--tw-leading, var(--text-4xl--line-height)); |
text-sm/6 | font-size: var(--text-sm); line-height: calc(var(--spacing) * 6); |
font-sans | font-family: var(--font-sans); |
font-mono | font-family: var(--font-mono); |
font-medium | font-weight: var(--font-weight-medium); /* 500 */ |
font-semibold | font-weight: var(--font-weight-semibold); /* 600 */ |
font-bold | font-weight: var(--font-weight-bold); /* 700 */ |
leading-tight | line-height: var(--leading-tight); /* 1.25 */ |
leading-6 | line-height: calc(var(--spacing) * 6); |
tracking-tight | letter-spacing: var(--tracking-tight); /* -0.025em */ |
tracking-wide | letter-spacing: var(--tracking-wide); |
text-left | text-align: left; |
text-center | text-align: center; |
text-right | text-align: right; |
uppercase | text-transform: uppercase; |
capitalize | text-transform: capitalize; |
italic | font-style: italic; |
underline | text-decoration-line: underline; |
no-underline | text-decoration-line: none; |
underline-offset-4 | text-underline-offset: 4px; |
decoration-2 | text-decoration-thickness: 2px; |
truncate | overflow: hidden; text-overflow: ellipsis; white-space: nowrap; |
line-clamp-3 | overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; |
text-balance | text-wrap: balance; |
text-pretty | text-wrap: pretty; |
whitespace-nowrap | white-space: nowrap; |
wrap-break-word | overflow-wrap: break-word; /* added in v4.1 */ |
tabular-nums | font-variant-numeric: tabular-nums; |
antialiased | -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; |
| Color and backgrounds | |
text-blue-600 | color: var(--color-blue-600); /* oklch(54.6% 0.245 262.881) */ |
bg-white | background-color: var(--color-white); /* #fff */ |
bg-slate-900 | background-color: var(--color-slate-900); |
bg-black/50 | background-color: color-mix(in oklab, var(--color-black) 50%, transparent); |
bg-[#4f98fb] | background-color: #4f98fb; |
bg-(--brand) | background-color: var(--brand); |
text-current | color: currentColor; |
bg-transparent | background-color: transparent; |
border-gray-200 | border-color: var(--color-gray-200); |
fill-current | fill: currentColor; |
accent-blue-600 | accent-color: var(--color-blue-600); |
caret-pink-500 | caret-color: var(--color-pink-500); |
bg-linear-to-r | background-image: linear-gradient(to right in oklab, var(--tw-gradient-stops)); /* simplified */ |
from-blue-500 | --tw-gradient-from: var(--color-blue-500); /* first stop */ |
to-violet-500 | --tw-gradient-to: var(--color-violet-500); |
bg-radial | background-image: radial-gradient(...stops); /* new in v4 */ |
bg-cover | background-size: cover; |
bg-center | background-position: center; |
bg-no-repeat | background-repeat: no-repeat; |
bg-clip-text | background-clip: text; |
| Borders, radius, rings and outlines | |
border | border-style: var(--tw-border-style); border-width: 1px; /* color is currentColor in v4 */ |
border-2 | border-style: var(--tw-border-style); border-width: 2px; |
border-t | border-top-style: var(--tw-border-style); border-top-width: 1px; |
border-dashed | --tw-border-style: dashed; border-style: dashed; |
rounded-xs | border-radius: var(--radius-xs); /* 0.125rem */ |
rounded-sm | border-radius: var(--radius-sm); /* 0.25rem */ |
rounded-md | border-radius: var(--radius-md); /* 0.375rem */ |
rounded-lg | border-radius: var(--radius-lg); /* 0.5rem */ |
rounded-2xl | border-radius: var(--radius-2xl); /* 1rem */ |
rounded-full | border-radius: calc(infinity * 1px); |
rounded-t-lg | border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); |
divide-y | border-bottom-width: 1px on every child except the last (selector: > :not(:last-child)) |
ring-1 | box-shadow: 0 0 0 1px currentColor; /* simplified; v4 default ring width is 1px */ |
ring-3 | box-shadow: 0 0 0 3px currentColor; /* the old v3 ring */ |
ring-blue-500 | --tw-ring-color: var(--color-blue-500); |
ring-offset-2 | --tw-ring-offset-width: 2px; |
outline | outline-style: var(--tw-outline-style); outline-width: 1px; |
outline-2 | outline-style: var(--tw-outline-style); outline-width: 2px; |
outline-offset-2 | outline-offset: 2px; |
outline-hidden | outline: 2px solid transparent; outline-offset: 2px; /* still visible in forced colors */ |
outline-none | --tw-outline-style: none; outline-style: none; |
| Effects and filters | |
shadow-2xs | box-shadow: 0 1px rgb(0 0 0 / 0.05); |
shadow-xs | box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); |
shadow-sm | box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); |
shadow-md | box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); |
shadow-lg | box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); |
shadow-2xl | box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); |
shadow-none | box-shadow: 0 0 #0000; |
inset-shadow-sm | box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.05); /* new in v4 */ |
opacity-50 | opacity: 50%; |
mix-blend-multiply | mix-blend-mode: multiply; |
blur-sm | filter: blur(var(--blur-sm)); /* 8px */ |
blur-xs | filter: blur(var(--blur-xs)); /* 4px */ |
backdrop-blur-md | backdrop-filter: blur(var(--blur-md)); /* 12px, frosted glass */ |
grayscale | filter: grayscale(100%); |
| Transitions, animation and transforms | |
transition | transition-property: color, background-color, border-color, outline-color, opacity, box-shadow, transform, translate, scale, rotate, filter and more; transition-duration: 150ms; |
transition-colors | transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke and gradient stops; 150ms |
duration-200 | transition-duration: 200ms; |
ease-out | transition-timing-function: var(--ease-out); /* cubic-bezier(0, 0, 0.2, 1) */ |
animate-spin | animation: var(--animate-spin); /* spin 1s linear infinite */ |
animate-pulse | animation: var(--animate-pulse); |
motion-reduce:animate-none | @media (prefers-reduced-motion: reduce) { animation: none; } |
scale-95 | --tw-scale-x: 95%; --tw-scale-y: 95%; scale: var(--tw-scale-x) var(--tw-scale-y); |
rotate-45 | rotate: 45deg; |
translate-x-4 | --tw-translate-x: calc(var(--spacing) * 4); translate: var(--tw-translate-x) var(--tw-translate-y); |
-translate-y-1/2 | --tw-translate-y: calc(calc(1/2 * 100%) * -1); translate: var(--tw-translate-x) var(--tw-translate-y); |
| Interactivity | |
cursor-pointer | cursor: pointer; /* v4 buttons default to cursor: default */ |
cursor-not-allowed | cursor: not-allowed; |
pointer-events-none | pointer-events: none; |
select-none | user-select: none; |
appearance-none | appearance: none; |
scroll-smooth | scroll-behavior: smooth; |
snap-x | scroll-snap-type: x var(--tw-scroll-snap-strictness); |
snap-start | scroll-snap-align: start; |
scroll-mt-20 | scroll-margin-top: calc(var(--spacing) * 20); |
resize-y | resize: vertical; |
touch-manipulation | touch-action: manipulation; |
| State and media variants | |
hover:bg-blue-700 | @media (hover: hover) { &:hover { background-color: var(--color-blue-700); } } |
focus-visible:outline-2 | &:focus-visible { outline-width: 2px; ... } |
active:scale-95 | &:active { scale: 95%; } |
disabled:opacity-50 | &:disabled { opacity: 50%; } |
aria-disabled:opacity-50 | &[aria-disabled="true"] { opacity: 50%; } |
group-hover:underline | .group:hover & { text-decoration-line: underline; } (inside @media (hover: hover)) |
peer-checked:bg-blue-600 | .peer:checked ~ & { background-color: var(--color-blue-600); } |
md:flex | @media (width >= 48rem) { display: flex; } |
max-md:hidden | @media (width < 48rem) { display: none; } |
@md:flex-row | @container (width >= 28rem) { flex-direction: row; } |
dark:bg-slate-900 | @media (prefers-color-scheme: dark) { background-color: var(--color-slate-900); } |
print:hidden | @media print { display: none; } |
motion-safe:animate-spin | @media (prefers-reduced-motion: no-preference) { ... } |
*:p-2 | :where(& > *) { padding: calc(var(--spacing) * 2); } |
not-last:mb-2 | &:not(:last-child) { margin-bottom: ... } |
supports-[display:grid]:grid | @supports (display: grid) { display: grid; } |
bg-red-500! | background-color: var(--color-red-500) !important; |
Notes on reading the table: calc(var(--spacing) * 4) is 1rem because the default --spacing is 0.25rem. Change that one variable in @theme and every padding, margin, gap, width and height that uses the number scale changes with it. Where the generated CSS is long (gradients, rings, transitions), the table shows a simplified version and says so.
How v4 turns a class into a value
There are four ways to give a utility a value in v4, and knowing which one you are using explains most surprises:
- A number on the spacing scale:
p-4,w-64,gap-3. Any whole number works, and so do quarter steps such asp-2.5, without config. The value iscalc(var(--spacing) * n). - A named theme value:
rounded-lg,shadow-md,text-xl,max-w-md. Each reads a variable such as--radius-lgor--container-md. - An arbitrary value in square brackets:
p-[13px],grid-cols-[200px_1fr],bg-[#4f98fb]. Underscores stand in for spaces. - A CSS variable in parentheses:
bg-(--brand)is v4 shorthand forbg-[var(--brand)]. In v3 you wrotebg-[--brand].
Fractions such as w-1/2 become calc(1/2 * 100%), and an opacity suffix such as bg-black/50 becomes a color-mix() with transparent, so it works with any color format.
@theme tokens (the v4 replacement for tailwind.config.js)
In v4 you configure the design system in CSS. Variables declared inside @theme become both CSS custom properties on :root and the source for utility classes. The prefix of the variable decides which utilities it feeds:
@import "tailwindcss";
@theme {
--font-display: "Satoshi", sans-serif; /* font-display */
--color-brand-500: oklch(65% 0.17 255); /* bg-brand-500, text-brand-500 ... */
--breakpoint-3xl: 120rem; /* 3xl: variant */
--spacing: 0.25rem; /* p-4 = 1rem */
--radius-card: 0.875rem; /* rounded-card */
}
| Namespace | Feeds | Example |
|---|---|---|
--color-* | every color utility (bg, text, border, fill, ring, shadow color...) | bg-red-500 |
--spacing | padding, margin, gap, width, height, inset, translate | px-4 |
--font-* | font family | font-sans |
--text-* | font size (plus optional --text-*--line-height) | text-xl |
--font-weight-* | font weight | font-bold |
--tracking-* / --leading-* | letter spacing / line height | tracking-wide |
--breakpoint-* | responsive variants | sm:* |
--container-* | container query variants and max-w-* | @sm:*, max-w-md |
--radius-* | border radius | rounded-sm |
--shadow-*, --inset-shadow-*, --drop-shadow-* | shadows | shadow-md |
--blur-* | blur and backdrop blur | blur-md |
--ease-* / --animate-* | timing functions / animations | ease-out, animate-spin |
--perspective-* / --aspect-* | 3D perspective / aspect ratio | perspective-near, aspect-video |
To drop a whole default namespace, set it to initial first, for example --color-*: initial;, then declare only your own colors. If you still have a JavaScript config, v4 can load it with @config "./tailwind.config.js";, but the corePlugins, safelist and separator options are not supported.
Breakpoints
Breakpoints are mobile first: an unprefixed class applies at every width, and md:flex applies from 48rem up. v4 writes them with the range syntax width >= ....
| Prefix | Min width | CSS | Below it (max-*) |
|---|---|---|---|
sm: | 40rem (640px) | @media (width >= 40rem) | max-sm: = @media (width < 40rem) |
md: | 48rem (768px) | @media (width >= 48rem) | max-md: |
lg: | 64rem (1024px) | @media (width >= 64rem) | max-lg: |
xl: | 80rem (1280px) | @media (width >= 80rem) | max-xl: |
2xl: | 96rem (1536px) | @media (width >= 96rem) | max-2xl: |
Stack them to target a range: md:max-xl:flex applies only from 48rem up to (not including) 80rem. For a one-off breakpoint use min-[900px]:grid or max-[600px]:hidden. Add or change breakpoints with --breakpoint-* in @theme, and keep them all in rem so they sort correctly.
Container queries
Container queries are built into v4 (in v3 they needed a plugin). Mark a parent with @container, then style children with @sm:, @md: and so on. They react to the parent's width rather than the window, which is what you want for a card that appears both in a sidebar and in a wide main column.
<div>
<article>
<img src="..." alt="">
<div>...</div>
</article>
</div>
| Variant | Container width | Variant | Container width |
|---|---|---|---|
@3xs | 16rem (256px) | @2xl | 42rem (672px) |
@2xs | 18rem (288px) | @3xl | 48rem (768px) |
@xs | 20rem (320px) | @4xl | 56rem (896px) |
@sm | 24rem (384px) | @5xl | 64rem (1024px) |
@md | 28rem (448px) | @6xl | 72rem (1152px) |
@lg | 32rem (512px) | @7xl | 80rem (1280px) |
@xl | 36rem (576px) |
Each one compiles to @container (width >= ...). Use @max-md: for "below", stack @sm:@max-md: for a range, name containers with @container/sidebar and target them with @md/sidebar:, and use arbitrary sizes such as @min-[475px]:. Note the container sizes are not the same numbers as the breakpoints: @md is 28rem while md: is 48rem.
Flex and grid quick reference
Pick a layout below and watch the boxes move. The class string updates as you click, so you can copy it straight into your markup.
The patterns you will reach for most often:
flex items-center justify-between: navbar rowflex items-center justify-center (or grid place-items-center): center one thinggrid grid-cols-3 gap-2 with col-span-2shrink-0 on the fixed item, flex-1 on the item that fills| Goal | Classes |
|---|---|
| Responsive card grid without breakpoints | grid grid-cols-[repeat(auto-fill,minmax(16rem,1fr))] gap-6 |
| Sidebar plus content | grid md:grid-cols-[16rem_1fr] gap-8 |
| Footer pinned to the bottom of a short page | flex min-h-dvh flex-col on the wrapper, flex-1 on main |
| Text that truncates inside a flex row | min-w-0 on the flex child, truncate on the text |
| Stack on mobile, row on desktop | flex flex-col md:flex-row gap-4 |
| Push the last item to the right | ms-auto (or ml-auto) on that item |
Default color palette (OKLCH), click to copy
v4 defines the default palette in OKLCH, which can show more saturated colors on wide-gamut screens. Each swatch below is painted with the exact value from Tailwind's own theme file; click one to copy its oklch() value. The shades run 50 to 950. Palettes marked * (mauve, olive, mist and taupe) were added in v4.2.0, so they are missing in earlier v4 releases. Black and white are #000 and #fff.
Use them as bg-sky-500, text-sky-500/80 or, in your own CSS, var(--color-sky-500). To check whether a pairing is readable, run it through the color contrast checker, and for a custom scale in the same format try the Tailwind color palette generator.
Dark mode in v4
By default dark: follows the operating system through @media (prefers-color-scheme: dark). To drive it from a class or attribute instead (for a manual toggle), override the variant in your CSS with @custom-variant. There is no darkMode config key any more.
/* Class strategy: <html> */
@custom-variant dark (&:where(.dark, .dark *));
/* Or a data attribute: <html data-theme="dark"> */
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
<div>...</div>
With a manual toggle, set the class before the page paints (a small inline script in <head> that reads the saved choice) so visitors do not see a flash of the wrong theme. A third option is to skip dark: classes entirely: define semantic tokens such as --color-surface in @theme and swap their values under .dark, so one class like bg-surface works in both themes.
v3 to v4: renamed and changed classes
These come from the official upgrade guide. The renames matter most because the old names still exist and quietly produce a different (smaller) result.
| v3 | v4 | Why |
|---|---|---|
shadow-sm | shadow-xs | Scale shifted down one step so every size has a name |
shadow | shadow-sm | Same shift |
drop-shadow-sm / drop-shadow | drop-shadow-xs / drop-shadow-sm | Same shift |
blur-sm / blur | blur-xs / blur-sm | Same shift (also backdrop-blur-*) |
rounded-sm | rounded-xs | Same shift |
rounded | rounded-sm | Same shift |
outline-none | outline-hidden | v4 outline-none now really sets outline-style: none |
ring (3px, blue-500) | ring-3 plus a color | Bare ring is now 1px in currentColor |
outline outline-2 | outline-2 | Width utilities now set a solid style themselves |
bg-opacity-50 (and text-, border-, ring-, divide-, placeholder-opacity) | bg-black/50 | Removed; use the slash modifier |
flex-shrink-0 / flex-grow | shrink-0 / grow | Removed aliases |
overflow-ellipsis | text-ellipsis | Removed alias |
decoration-slice / decoration-clone | box-decoration-slice / box-decoration-clone | Removed aliases |
bg-[--brand] | bg-(--brand) | New shorthand for CSS variables |
!bg-red-500 | bg-red-500! | Important goes at the end (old form deprecated) |
first:*:pt-0 | *:first:pt-0 | Stacked variants now read left to right |
tw-flex (prefix) | tw:flex | Prefixes look like a variant and come first |
Behavior changes with no rename, which catch people during upgrades:
- Border and divide color: default is now
currentColorinstead of gray-200, so a bareborderlooks dark. Add a color such asborder-gray-200. - Hover on touch screens:
hover:is wrapped in@media (hover: hover), so a tap no longer triggers sticky hover styles. - Buttons: Preflight now gives buttons
cursor: defaultlike the browser does. Addcursor-pointerif you want the hand. - space-x / space-y and divide: the selector changed to
> :not(:last-child)and the margin moved to the end side. If spacing looks off, switch toflexorgridwithgap. - container: the
centerandpaddingoptions are gone; extend it with@utility container { margin-inline: auto; padding-inline: 2rem; }. - Gradients: v4 names linear gradients
bg-linear-to-rand addsbg-radialandbg-conic. - Browsers: v4 targets Safari 16.4+, Chrome 111+ and Firefox 128+. If you must support older browsers, the upgrade guide says to stay on v3.4.
The official npx @tailwindcss/upgrade tool handles most renames automatically. Run it on a clean branch and review the diff, since it cannot know which shadow classes you meant to keep looking the same.
Printing this sheet
This page has print styles: the search boxes and buttons are hidden, the tables shrink to a smaller font, and the color grid keeps its swatches together. In most browsers, turn on "Background graphics" in the print dialog or the swatches print blank. If you filtered the table first, only the visible rows print, which is a quick way to make a one-page sheet of just the utilities you use.
The same print: variant works in your own projects: print:hidden on navigation, print:text-black on light text, and print:break-inside-avoid on cards keep printed pages readable.
Related
- CSS button states: hover, focus-visible, active and disabled, in plain CSS and Tailwind.
- Website color schemes for choosing a palette before you map it to tokens.
- CSS grid generator and the component gallery of Tailwind sections you can copy.
Frequently asked questions
Where is tailwind.config.js in Tailwind v4?
v4 is configured in CSS. You import Tailwind with @import "tailwindcss" and declare design tokens inside an @theme block, such as --color-brand-500 or --breakpoint-3xl. A JavaScript config can still be loaded with the @config directive, but the corePlugins, safelist and separator options are not supported.
What are the default Tailwind v4 breakpoints?
sm is 40rem (640px), md is 48rem (768px), lg is 64rem (1024px), xl is 80rem (1280px) and 2xl is 96rem (1536px). They are mobile first, so md:flex applies from 48rem and wider. Use max-md: for styles below a breakpoint and stack them, such as md:max-xl:, for a range.
Why do my shadows and rounded corners look smaller after upgrading to v4?
The shadow, radius and blur scales moved down one step. v3 shadow-sm is v4 shadow-xs, v3 shadow is v4 shadow-sm, v3 rounded-sm is v4 rounded-xs and v3 rounded is v4 rounded-sm. The old names still compile, so nothing errors; they just produce the next size down.
How do I make dark mode use a class instead of the system setting in v4?
Add @custom-variant dark (&:where(.dark, .dark *)); to your CSS. dark: utilities then apply whenever an ancestor has the dark class. Use [data-theme=dark] in the selector instead if you prefer a data attribute.
Does Tailwind v4 need a plugin for container queries?
No. Container queries are built in. Put @container on the parent and use variants such as @sm:, @md: and @max-md: on its children. The container sizes start at @3xs (16rem) and differ from the page breakpoints, for example @md is 28rem.
What does p-4 compile to in Tailwind v4?
padding: calc(var(--spacing) * 4). With the default --spacing of 0.25rem that is 1rem (16px at the default font size). Any whole number works on the spacing scale without configuration, and changing --spacing rescales all of them at once.
More in Guides
- Tailwind CSS Colors: The Full Default Palette
- Tailwind vs Bootstrap: One Section, Built Twice
- Team Page Examples
- Terms of Service vs Privacy Policy
- Is a White-Label Website Builder Good for Client SEO? A 12-Point Test to Run Before You Commit | How-to Guide
- Thank You Page Examples
- This Site Can't Be Reached: What Each Error Code Means
- TOML vs YAML: Same Config, Three Formats
Start building
- how to make a website
- AI website builder
- free website builder
- website templates
- website builders by industry
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App