Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

For a Vite project, use Tailwind’s dedicated @tailwindcss/vite plugin. For a project built around PostCSS rather than Vite, use @tailwindcss/postcss. In either setup, replace the v3 @tailwind directives with @import "tailwindcss";. Then inspect the migration diff and test the rendered site: a successful build alone does not confirm that styles still behave as intended.

Choose the integration that matches your build

Tailwind’s v4 migration changes both the package used to integrate Tailwind and the CSS entry syntax. Start by identifying how the project builds CSS, rather than choosing a plugin just because it appears in an older configuration.

Project pipeline Tailwind integration CSS entry
Vite @tailwindcss/vite, registered in the Vite configuration @import "tailwindcss";
PostCSS-driven integration @tailwindcss/postcss, configured in the PostCSS configuration @import "tailwindcss";

Tailwind’s Upgrade guide recommends migrating Vite projects from the PostCSS plugin to its dedicated Vite plugin “for improved performance and the best developer experience.” Follow a framework-specific Tailwind guide if your Vite framework requires a particular setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Vite setup

Install tailwindcss and @tailwindcss/vite, then register the plugin in the project’s Vite configuration. For example, in a TypeScript Vite config:

import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [tailwindcss()],
});

In the CSS entry file that your app loads, use:

@import "tailwindcss";

Keep the rest of the Vite configuration and other plugins your application needs. The example shows the Tailwind registration, not a complete replacement for an existing config.

PostCSS setup

For a PostCSS pipeline, install tailwindcss, @tailwindcss/postcss, and postcss. Configure the dedicated package in the PostCSS configuration. The v4 PostCSS plugin is no longer the tailwindcss package itself; changing that old v3 arrangement is a required part of the migration.

export default {
  plugins: {
    "@tailwindcss/postcss": {},
  },
};

Use the same CSS entry import, @import "tailwindcss";. If your PostCSS config also serves other parts of the application, retain the plugins those other parts still require.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the migration and review what it changes

For a typical v3-to-v4 migration, Tailwind provides npx @tailwindcss/upgrade. The official guide says the tool requires Node.js 20 or higher; that requirement is for running the upgrade tool, not a stated general runtime requirement for every Tailwind v4 project. The tool can update dependencies, move configuration into CSS, and adjust templates, but it does not eliminate the need to review the result.

  1. Make a branch or other recoverable checkpoint. This gives you a clean way to inspect and revert migration changes independently of unrelated work.
  2. Run the upgrade tool: npx @tailwindcss/upgrade. Review the generated diff rather than assuming every project-specific detail has been handled.
  3. Set up the correct integration. Use the Vite plugin for a Vite project or the dedicated PostCSS package for a PostCSS pipeline, then change the CSS entry to @import "tailwindcss";.
  4. Check browser requirements before shipping. The Tailwind CSS Upgrade guide currently lists Safari 16.4+, Chrome 111+, and Firefox 128+ as v4’s browser targets. These are the guide’s stated minimum targets, not a guarantee about every browser or embedded webview. If your project must support older browsers, the guide recommends staying on v3.4.
  5. Inspect and test the result in a browser. Check representative pages and interactive states, especially where your project uses custom configuration or utilities affected by v4 changes.

Check these breaking changes, not just the build output

A clean compile confirms that the build can run; it does not prove that your existing design, configuration, or browser support survived unchanged. Use Tailwind’s complete upgrade guide alongside the project’s own visual checks.

  • CSS entry directives: Replace @tailwind base;, @tailwind components;, and @tailwind utilities; with the regular CSS import @import "tailwindcss";.
  • JavaScript configuration: JavaScript config files remain supported for backward compatibility, but v4 does not detect them automatically. Load a configuration file explicitly with @config when needed. Some legacy options, including corePlugins, safelist, and separator, are not supported in v4.
  • PostCSS plugins: Tailwind handles imports and vendor prefixing automatically in v4, so the guide says postcss-import and autoprefixer can be removed from the described Tailwind setup. Before removing either, check whether another part of your build still depends on it.
  • Border color default: The default changed from the configured gray-200 behavior in v3 to currentColor in v4. Add explicit border colors where the appearance should remain fixed, or use the guide’s compatibility CSS if retaining the old default is intentional.
  • Stacked variant order: Order changed from right-to-left to left-to-right. Review stacked variants whose result depends on ordering.
  • Utility names and defaults: Some shadow, radius, blur, and outline utilities changed. Check the full upgrade guide for the specific utilities your project uses; this list is not exhaustive.
  • CSS preprocessors: Tailwind v4 is not designed for Sass, Less, or Stylus preprocessing. A project relying on one of these must account for that compatibility constraint before adopting v4.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to pause the upgrade

Do not treat a successful dependency update as the only go/no-go test. The browser floor may rule out v4 for a project that must serve older browsers, and a Sass, Less, or Stylus-based workflow needs a compatibility plan. If neither constraint applies, choose the integration that matches the actual build pipeline, review the changed defaults and configuration behavior, and verify the site in the browsers and states your users rely on.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.