Home Blog Next-Gen Web and Frontend De Tailwind CSS v4: new features and migration guide
Next-Gen Web and Frontend De January 18, 2026 8 min read

Tailwind CSS v4: new features and migration guide

Next-Gen Web and Frontend De Enterprise Guide 2026 SCALE D2C D2C Technology Next-Gen Web and Frontend De Enterprise Guide 2026 SCALE D2C D2C Technology

Tailwind CSS v4 represents the most significant architectural overhaul since the framework launched. Built on a new high-performance Rust engine, it removes the PostCSS dependency, introduces a CSS-first configuration model, and delivers substantially faster build times. This guide covers every major change and how to migrate your existing projects.

What's New in Tailwind CSS v4

Tailwind CSS v4 was released in early 2025 and fundamentally changes how the framework is configured, compiled, and integrated into build pipelines. The headline changes are: a new Oxide engine written in Rust that makes full builds up to 10× faster and incremental builds up to 100× faster; a CSS-first configuration system that replaces tailwind.config.js; native CSS cascade layers; first-class container query support; and a completely overhauled theming system using CSS custom properties.

10×
Faster full build vs Tailwind v3
100×
Faster incremental builds
0
PostCSS plugins required for basic usage

The Oxide Engine: Rust-Powered Performance

The Oxide engine replaces the JavaScript-based scanner that Tailwind used in v3. It is written in Rust and integrated via a native Node.js module, which means the template scanning and CSS generation pipeline runs at native speed. For large projects with thousands of components, this translates to full build times dropping from 3–8 seconds to under 300ms, and incremental HMR updates becoming near-instantaneous.

Oxide also changes how Tailwind detects classes. In v3, you had to configure content paths explicitly. In v4, Oxide uses a smarter file detection algorithm that automatically finds templates based on your project structure, eliminating one of the most common configuration mistakes in v3 projects.

💡 Migration Note

The automatic content detection in v4 works well for standard project structures but may need configuration hints for monorepos or projects with non-standard source directories. Use the @source directive in your CSS file to specify additional paths.

CSS-First Configuration

The biggest workflow change in v4 is replacing tailwind.config.js with a CSS-first configuration model. All theme customisation now happens directly in your CSS file using @theme, @utility, and @variant directives.

/* tailwind.css */
@import "tailwindcss";

@theme {
  --font-sans: "Inter", sans-serif;
  --color-brand: oklch(55% 0.25 265);
  --color-brand-hover: oklch(45% 0.25 265);
  --spacing-18: 4.5rem;
  --radius-xl: 1rem;
}

@utility btn-primary {
  @apply px-6 py-3 bg-brand text-white rounded-xl font-medium;
  &:hover { @apply bg-brand-hover; }
}

This approach has several advantages over the JavaScript config file: co-location of design tokens with CSS, better IDE integration, easier sharing of theme tokens across stylesheets, and alignment with the direction of the web platform (CSS custom properties are now the standard theming primitive).

The New Theme System

In v4, every design token in the default theme is exposed as a CSS custom property under the -- namespace. This means Tailwind's spacing scale, colour palette, typography scale, and breakpoints are all available as CSS variables throughout your stylesheets, not just in Tailwind utilities.

Token Categoryv3 Accessv4 Access
ColoursOnly via Tailwind classesvar(--color-blue-500) in any CSS
SpacingOnly via Tailwind classesvar(--spacing-4) in any CSS
BreakpointsConfig file or theme() functionvar(--breakpoint-lg) in media queries
Font sizesOnly via Tailwind classesvar(--text-xl) in any CSS
Custom tokensJS config + CSS variables (manual)Define once in @theme, available everywhere

First-Class Container Queries

Container queries are now fully supported in v4 without any plugin. Use the @container variant with responsive-style syntax:

<div class="@container">
  <div class="grid @md:grid-cols-2 @lg:grid-cols-3 gap-4">
    <!-- Responsive to container width, not viewport -->
  </div>
</div>

This is a landmark improvement for component-driven design. Previously, building components that respond to their container's width required either the @tailwindcss/container-queries plugin (v3) or custom CSS. In v4, container queries are first-class syntax, making it trivial to build truly reusable layout components.

CSS Cascade Layers

v4 wraps Tailwind's generated CSS in native CSS cascade layers (@layer base, @layer components, @layer utilities). This solves one of the long-standing complaints about Tailwind: specificity conflicts with existing CSS. With cascade layers, you can define your own styles at a higher layer and they will reliably override Tailwind utilities without needing !important or specificity gymnastics.

Migration Guide: v3 to v4

01
Run the Upgrade CLI
Tailwind provides an automated migration tool: npx @tailwindcss/upgrade. It handles the majority of changes including config file conversion, renamed utilities, and PostCSS config updates.
02
Convert tailwind.config.js to @theme
Move custom colours, fonts, spacing, and other design tokens from tailwind.config.js into @theme blocks in your main CSS file. The CLI handles most of this automatically.
03
Remove PostCSS Config (Optional)
If you were using Tailwind via PostCSS, you can now switch to the new standalone Vite plugin or CLI for better performance. The PostCSS approach still works but is no longer the recommended path.
04
Audit Renamed Utilities
Some utility names changed in v4. Key renames: shadow-smshadow-xs; ring default is now 1px (was 3px); blur scale updated. Run the upgrade CLI and review diffs carefully.
05
Test Container Queries
If you used the @tailwindcss/container-queries plugin in v3, remove it — the syntax is now built-in but slightly different. Update container-type usage to use the new @container classes.

Enterprise Adoption Considerations

For enterprise design systems, v4 introduces important architectural decisions. The CSS-first configuration model is a significant departure from the JavaScript config teams may have spent years building around. Migration requires updating build pipelines, IDE integrations, design token pipelines (if you generate tailwind.config.js from a design tool like Figma Tokens or Style Dictionary), and any custom plugins.

⚠ Design Token Pipeline Impact

If your design system uses Style Dictionary, Theo, or Figma Tokens Plugin to generate a tailwind.config.js, you'll need to update your token pipeline to output @theme CSS syntax instead. Most tools have v4 support in their latest releases.

The performance improvements make v4 compelling even for teams that have heavily customised v3 setups. Build time improvements alone justify migration for large projects where slow rebuilds were impacting developer productivity. Plan a phased migration: update the CLI and engine first, then progressively migrate configuration to the new CSS-first model.

Frequently Asked Questions

Tailwind v4 is not fully backwards compatible with v3. While the utility class syntax is largely similar, there are breaking changes including renamed utilities (e.g. shadow scales), a new configuration model (CSS-first vs JavaScript config), PostCSS is no longer required, and some default values have changed (e.g. ring width). Tailwind provides an official upgrade CLI (npx @tailwindcss/upgrade) that automates most of the migration. Large projects should plan for a few days of migration and testing work.

No. Tailwind v4 can be used without PostCSS. It ships a standalone Vite plugin (@tailwindcss/vite), a CLI tool, and integrations for other bundlers. PostCSS is still supported for legacy setups, but the recommended approach for new projects is to use the Vite plugin or the bundler-native integration for your stack. Removing PostCSS typically results in faster build times.

Instead of a JavaScript config file, you configure Tailwind v4 directly in your CSS file using the @theme directive to define design tokens (colours, spacing, fonts), the @utility directive to create custom utilities, and the @variant directive to add custom variants. All theme tokens are automatically exposed as CSS custom properties, making them available throughout your stylesheet. The migration CLI can convert an existing tailwind.config.js to the new CSS format.

Container queries allow elements to respond to the size of their parent container rather than the viewport. In Tailwind v4, mark a container with class="@container" and then apply responsive utilities using @sm:, @md:, @lg: prefixes on child elements. These prefixes respond to the container's width rather than the browser window, enabling truly reusable components that adapt to their layout context. Previously this required a separate plugin in v3.

Tailwind reports full builds up to 10× faster and incremental builds up to 100× faster in v4 compared to v3, thanks to the Rust-based Oxide engine. In practice, on large projects with thousands of components, full build times typically drop from 3–10 seconds to under 300ms. Incremental HMR rebuilds go from 200–500ms to near-instantaneous (under 10ms). The actual improvement depends on project size and complexity.

Yes, for most new projects Tailwind v4 is the recommended choice. The ecosystem has stabilised since the initial release, major frameworks (Next.js, Nuxt, SvelteKit, Astro) all have v4 integrations, and the performance improvements are significant. The main exception is projects where you have specific dependencies on v3 plugins that haven't yet been updated for v4 — check plugin compatibility before committing to v4 if your project relies on third-party Tailwind plugins.

Most design token tools have added v4 support. Style Dictionary can output @theme CSS format via its CSS formatter. Figma Variables (formerly Tokens) plugins like Token Studio have updated their Tailwind export to generate v4-compatible CSS. If you're using an older pipeline, you may need to update your token transformation step to output @theme { --color-*: ...; } syntax instead of a JavaScript config object. Check your specific tooling's changelog for v4 migration guides.

JIT (Just-In-Time) mode was the default in Tailwind v3 and is effectively the only mode in v4. The Oxide engine builds on and extends the JIT approach, scanning templates to generate only the utilities your project uses. There is no longer a concept of a separate JIT vs AOT mode — all builds in v4 use the high-performance on-demand compilation approach that JIT introduced in v3.

TAILWIND C

Ready to Implement Tailwind CSS v4: new features and migration guide?

Our specialist team delivers measurable ROI from Next-Gen Web and Frontend De programmes for enterprise and D2C brands.

Free Audit