/changelogs/tailwindcss/tailwind-v3-to-v4
Tailwind CSS v3 to v4: renamed utilities and breaking changes
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated 2026-10-20
- tool
- Tailwind CSS
- versions
- 3.4 → 4.x
Tailwind CSS v4 is configured in CSS instead of tailwind.config.js, ships its build tools in separate packages, and renames several utility scales. The official upgrade tool, npx @tailwindcss/upgrade, rewrites most of a project automatically; review the diff, because the renamed utilities change how things look.
Setup changes
@tailwind base;
@tailwind components;
@tailwind utilities;@import "tailwindcss";
@theme {
--color-brand: #0e7c86;
--font-display: "Inter", sans-serif;
}| v3 | v4 |
|---|---|
| tailwindcss as a PostCSS plugin | @tailwindcss/postcss |
| npx tailwindcss -i in.css -o out.css | npx @tailwindcss/cli -i in.css -o out.css |
| PostCSS in Vite projects | @tailwindcss/vite plugin |
| tailwind.config.js theme.extend | @theme variables in CSS (a JS config can still be loaded with @config) |
| postcss-import, autoprefixer | built in, remove them |
Renamed utilities
| v3 | v4 |
|---|---|
| shadow-sm | shadow-xs |
| shadow | shadow-sm |
| drop-shadow-sm / drop-shadow | drop-shadow-xs / drop-shadow-sm |
| blur-sm / blur | blur-xs / blur-sm |
| backdrop-blur-sm / backdrop-blur | backdrop-blur-xs / backdrop-blur-sm |
| rounded-sm / rounded | rounded-xs / rounded-sm |
| outline-none | outline-hidden (outline-none now really sets outline-style: none) |
| ring (3px) | ring-3 (ring is 1px in v4) |
| bg-opacity-50, text-opacity-*, … | opacity modifiers: bg-black/50 |
| flex-shrink-* / flex-grow-* | shrink-* / grow-* |
| overflow-ellipsis | text-ellipsis |
| bg-gradient-to-r | bg-linear-to-r |
See the new names compiled
npm init -y >/dev/null
npm install --silent --no-audit --no-fund tailwindcss@4 @tailwindcss/cli@4 >/dev/null 2>&1
echo '@import "tailwindcss";' > in.css
echo '<div class="shadow-xs rounded-xs ring-3 outline-hidden bg-linear-to-r"></div>' > index.html
npx @tailwindcss/cli -i in.css -o out.css 2>/dev/null
grep -oE '^\s*\.(shadow-xs|rounded-xs|ring-3|outline-hidden|bg-linear-to-r)' out.css | sed 's/^ *//' | sort -uOutput
.bg-linear-to-r .outline-hidden .ring-3 .rounded-xs .shadow-xs
Other behaviour changes
- Border colour:
borderanddivideusecurrentColorinstead ofgray-200; addborder-gray-200where you relied on the old default. - Variants stack left to right:
*:first:pt-0instead of v3's right-to-left order. - Hover only applies on devices that support hover (
@media (hover: hover)). - Browsers: v4 depends on
@propertyandcolor-mix()and targets Safari 16.4, Chrome 111 and Firefox 128. Stay on v3.4 if you must support older browsers.
Sources
Related pages
cheat sheets · cssCSS flexbox cheat sheet: container and item propertiesCSS flexbox cheat sheet: display flex, flex-direction, justify-content, align-items, flex-wrap and gap on the container; flex, align-self, order on items.commands · prettierprettier --write and --check: format files from the command lineFormat a project with npx prettier . --write, or fail CI on unformatted files with npx prettier . --check. Configure it with .prettierrc and .prettierignore.compat · cssCSS :has() browser supportCSS :has() works in Chrome and Edge 105+, Safari 15.4+ and Firefox 121+, per MDN browser-compat-data. Feature-detect it with @supports selector(:has(a)).