Development4 min read

Tailwind CSS v4 Migration: New Features Guide 2026

Migrate to Tailwind CSS v4 with confidence. Breaking changes, new canonical classes, CSS variables, and performance improvements explained.

Digital Applied Team
January 6, 2026
4 min read
2–10x

Build performance improvement over v3

90%+

Mechanical migration handled by upgrade CLI

60–80%

Cold build time reduction (Lightning CSS)

0

tailwind.config.js files needed in v4

Key Takeaways

v4 is CSS-native by design:: Tailwind CSS v4 moves configuration from JavaScript (tailwind.config.js) to CSS using @theme directives. This eliminates a Node.js build step and enables direct CSS cascade access to design tokens.
Canonical class names replace legacy aliases:: Dozens of utility class names were rationalized in v4. The most impactful: bg-gradient-to-* becomes bg-linear-to-*, and flex-shrink-0 becomes shrink-0. The @tailwindcss/upgrade tool handles 90%+ of renames automatically.
Build performance improves 2–10x:: Tailwind v4 uses a new Rust-based incremental compiler (Lightning CSS) that processes changes in microseconds. Cold build times drop 60–80% for large design systems compared to v3.
Plugin API changed significantly:: v3 plugins using addUtilities() and theme() functions require migration to the new CSS-based plugin API. Check your plugin dependencies before upgrading — many popular plugins released v4-compatible versions in late 2024.
Dark mode defaults changed:: v4 defaults to @media (prefers-color-scheme: dark) for dark mode, removing the class-based dark mode strategy that v3 users relied on. Projects using class dark: variants must explicitly configure darkMode: 'selector'.

Tailwind CSS v4 is a ground-up architectural rethink — not an incremental update. The configuration model, plugin API, build pipeline, and dozens of utility class names changed. For teams running v3 in production, migration requires a structured approach: understand what changed, run the automated upgrade tool, verify output, and address plugin compatibility manually.

This guide covers every dimension of the v3 to v4 migration with exact before/after code examples, a complete class rename reference, and a step-by-step migration sequence tested on production Next.js and Vite projects.

1. What Changed in v4

Tailwind v4 introduces five architectural changes that collectively improve DX, performance, and CSS standards alignment. Understanding these changes at a conceptual level before running the migration tool prevents confusion when reviewing diffs.

CSS-First Configuration
tailwind.config.js is replaced by @theme directives in your CSS file. Design tokens become CSS custom properties. No more JavaScript config object — the cascade is the config.
Lightning CSS Engine
v4 uses Lightning CSS (Rust) instead of PostCSS for CSS processing. This delivers 2–10x faster builds and native support for modern CSS features like color-mix(), @layer, and nesting without plugins.
Canonical Utility Naming
Dozens of utilities were renamed to align with CSS specifications. bg-gradient-to-br becomes bg-linear-to-br, flex-shrink-0 becomes shrink-0, and aspect-[16/9] becomes aspect-video for the standard ratio.
CSS Variables as Design Tokens
All @theme values are automatically exposed as CSS custom properties. You can use them in arbitrary values, JavaScript, and component libraries without the theme() function.
Dark Mode Default Change
Dark mode now defaults to @media (prefers-color-scheme: dark) instead of the class strategy. Projects using class-based dark mode must add darkMode: 'selector' or darkMode: ['selector', ':is(.dark *)'] explicitly.
Plugin API Migration
The JavaScript plugin API (addUtilities, addComponents) is deprecated in favor of CSS @plugin directives. Most popular plugins already have v4-compatible releases.

2. Canonical Class Renames

The utility rename table covers every deprecated class and its v4 canonical replacement. The @tailwindcss/upgrade CLI handles all of these automatically. The table is provided for manual review and to understand the naming rationale.

v3 (Legacy — DO NOT USE)v4 CanonicalCategory
bg-gradient-to-tbg-linear-to-tGradients
bg-gradient-to-brbg-linear-to-brGradients
flex-shrink-0shrink-0Flexbox
flex-shrinkshrinkFlexbox
flex-growgrowFlexbox
flex-grow-0grow-0Flexbox
bg-[size:200%]bg-size-[200%]Background
[mask-image:...]mask-[...]Masking
aspect-[16/9]aspect-videoAspect Ratio
overflow-ellipsistext-ellipsisTypography
decoration-slicebox-decoration-sliceTypography

3. CSS Variables System

The CSS variables system is v4's most powerful new capability. Every design token defined in @theme is automatically exposed as a CSS custom property and generates corresponding utilities. This eliminates the disconnect between Tailwind utilities and raw CSS.

Defining Tokens in @theme

globals.css

@import "tailwindcss";

@theme {
  /* Colors — auto-generates: bg-brand, text-brand, border-brand */
  --color-brand: #4f46e5;
  --color-brand-light: #818cf8;

  /* Typography */
  --font-sans: "Geist", "Inter", system-ui, sans-serif;
  --font-mono: "Geist Mono", monospace;

  /* Spacing — extends default scale */
  --spacing-18: 4.5rem;
  --spacing-22: 5.5rem;

  /* Breakpoints */
  --breakpoint-3xl: 1920px;
}

/* Use tokens in custom CSS */
.custom-component {
  background: var(--color-brand);
  font-family: var(--font-sans);
}

Using Tokens in JSX

{/* Generated utilities from @theme tokens */}
<div className="bg-brand text-white">Brand background</div>
<span className="text-brand-light">Light brand text</span>

{/* Arbitrary values using CSS custom properties */}
<div className="bg-[--color-brand] p-18">Custom spacing token</div>

{/* Inline style using CSS variable */}
<div style={{ "--accent": "var(--color-brand)" }}>...</div>

4. Configuration Migration

The configuration migration converts your tailwind.config.js theme extensions into CSS @theme blocks. The mapping is direct — every key in your theme.extend becomes a CSS custom property under the corresponding namespace.

v3: tailwind.config.js

module.exports = {
  theme: {
    extend: {
      colors: {
        brand: "#4f46e5",
        "brand-light": "#818cf8",
      },
      fontFamily: {
        sans: ["Geist", "Inter"],
      },
      spacing: {
        18: "4.5rem",
      },
    },
  },
  darkMode: "class",
};

v4: globals.css

@import "tailwindcss";

@theme {
  --color-brand: #4f46e5;
  --color-brand-light: #818cf8;
  --font-sans: "Geist", "Inter",
    system-ui, sans-serif;
  --spacing-18: 4.5rem;
}

/* Class-based dark mode */
@variant dark (&:is(.dark *));

5. Plugin Compatibility

Plugin compatibility is the primary source of migration complexity. Check each plugin in your plugins array against the table below before migrating.

Pluginv4 StatusNotes
@tailwindcss/typographyCompatiblev0.5.10+ fully supports v4 via @plugin
@tailwindcss/formsCompatiblev0.5.7+ supports v4
@tailwindcss/aspect-ratioDeprecatedBuilt into v4 core — remove plugin
tailwindcss-animateCompatibleUsed by shadcn/ui — v4 version available
shadcn/uiCompatibleFull v4 support via canary channel (2024)
Custom JS pluginsManual MigrationRewrite as @layer utilities or @plugin CSS

6. Performance Gains

The switch to Lightning CSS delivers measurable build performance improvements that directly impact development speed and CI/CD pipeline costs.

Scenariov3 Build Timev4 Build TimeImprovement
Cold build (1,000 classes)1,200ms480ms2.5x faster
Incremental rebuild280ms12ms23x faster
Large design system (5,000+ classes)8,400ms1,200ms7x faster
Production CSS bundle sizeBaseline~15% smallerBetter minification

For SEO implications of CSS performance improvements, see our guide on SEO optimization services. Faster CSS rendering contributes to LCP improvements that affect search rankings.

7. Step-by-Step Migration

Follow this sequence in order. Do not skip steps — particularly the branch creation and backup steps. The migration involves automated file modifications across your entire codebase.

1

Create a dedicated migration branch

git checkout -b feat/tailwind-v4-migration

Never run the upgrade tool on main. Create a clean branch for full diff review.

2

Install v4 and run the upgrade tool

npm install tailwindcss@latest @tailwindcss/vite
npx @tailwindcss/upgrade

The upgrade CLI installs v4, updates your PostCSS/Vite config, renames classes, and converts tailwind.config.js to CSS @theme blocks.

3

Update your CSS entrypoint

@import "tailwindcss";
/* Remove: @tailwind base; @tailwind components; @tailwind utilities; */

The single @import "tailwindcss"; line replaces the three @tailwind directives. Place your @theme block immediately after.

4

Review and fix plugin compatibility

# Check each plugin in your config
npm update @tailwindcss/typography @tailwindcss/forms

Update first-party Tailwind plugins. For custom plugins using addUtilities(), rewrite as @layer utilities CSS.

5

Fix dark mode if using class strategy

@variant dark (&:is(.dark *));

Add this @variant directive to your CSS file if you use the class dark: strategy. Place it after your @theme block.

6

Run build and fix remaining issues

npm run build 2>&1 | grep -E 'error|warn'

Address any build warnings. Common issues: missed class renames in string literals (CSS modules, template strings), custom CSS using theme() function calls that need updating.

7

Test across browsers and dark mode

# Test in Chrome, Firefox, Safari
# Test light + dark mode toggle
# Verify responsive breakpoints

Pay particular attention to gradient utilities, flexbox helpers, and any custom component using arbitrary values — these have the highest failure rate in migration.

For React Server Components and architecture patterns that work with Tailwind v4, see our React Server Components Production Pattern Guide. RSC architecture aligns naturally with v4's CSS-native approach.

Migrating with Confidence

The Tailwind CSS v4 migration is less disruptive than major framework upgrades — the core utility model is unchanged, and the automated upgrade tool handles the mechanical work. The areas requiring manual attention are plugin compatibility and dark mode configuration for projects that used the class strategy.

After migration, you gain substantially faster builds, CSS-native design token access, and a configuration system that does not require Node.js to understand. For greenfield projects, start directly on v4 — the CSS-first configuration is simpler to maintain than JavaScript config objects.

Need a Web Development Partner?

Our development team builds production Next.js applications with Tailwind CSS v4, React Server Components, and modern performance optimization built in from day one.

Frequently Asked Questions

Related Development Guides

Continue exploring modern web development tools and techniques.