Skip to content

Menu

Tailwind Config Generator

Generate tailwind.config.js from settings

Runs entirely in your browserFrontendFree, no sign-up
Loading tool

01What is Tailwind Config Generator?

Tailwind CSS v4 moved configuration out of JavaScript and into your stylesheet. You import the framework with @import "tailwindcss" and declare design tokens as CSS variables inside an @theme block, as the Theme variables page of the Tailwind docs describes. Getting the variable names right by hand is fiddly, so this generator writes that CSS for you, and it can still produce a classic tailwind.config.js for projects on v3. In v4 mode, each color becomes a --color-* variable, so --color-primary gives you bg-primary, text-primary and border-primary. Font stacks become --font-*, spacing keys become --spacing-*, and radii become --radius-*. Keys are lowercased and anything that is not a letter, digit or hyphen turns into a hyphen, so a color named Brand Blue comes out as --color-brand-blue. Font names that contain spaces get quotes, while generic families such as sans-serif and system-ui are left bare. Breakpoints get special care. Tailwind's own defaults are written in rem, and mixing px and rem can sort them in the wrong order, so px values are divided by 16. If you keep the five default breakpoints, only your extra ones are written. Change a default and the tool adds --breakpoint-*: initial first, which replaces the whole set. The Dark Mode select maps to the docs too. Class writes the @custom-variant dark rule that matches .dark on html or any ancestor. Media writes only a comment, because prefers-color-scheme is already the v4 default. A Prefix such as tw- is cleaned to tw and written as prefix(tw) on the import, and your classes then look like tw:flex. Container centering and padding are no longer theme options in v4, so they come out as an @utility container block. Here is a quick example. Load Container + screens and the theme gains --breakpoint-xs: 29.6875rem and --breakpoint-3xl: 120rem, which are 475px and 1920px over 16. The container block gets padding-inline: 1.5rem. A few limits. You can add and remove colors in the UI, but fonts, spacing, breakpoints, radius and container only change through the three examples. Each color is a single value, so you get bg-primary, not a 50 to 950 scale. The v3 file always lists the same three content globs and an empty plugins array. The whole config is built from string templates in your tab, and nothing is uploaded.

Front-end developers setting up or migrating a Tailwind project who want correct @theme variable names without reading the whole theme docs page. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Tailwind Config Generator

  1. Pick the Tailwind version: v4 (current): CSS @theme, or v3 (legacy): tailwind.config.js.
  2. Load one of the examples (Dark mode + custom colors, Custom fonts + spacing, Container + screens) or keep the defaults. The reset button goes back to the defaults.
  3. Choose Dark Mode (class, media or not configured) and type a Prefix if you need one.
  4. Under Colors, type a key, pick a value with the color picker or hex field and click Add. Click × on any chip you want to drop.
  5. Read the output panel and click Copy. Paste v4 output into your main CSS file in place of the old @tailwind lines, or save v3 output as tailwind.config.js.

03Worked examples

Input: Defaults, v4, Dark Mode class
Result: @import "tailwindcss"; @custom-variant dark (&:where(.dark, .dark *)); @theme { --color-primary: #3b82f6; --color-secondary: #6366f1; --color-accent: #f59e0b; --font-sans: Inter, system-ui, sans-serif; --font-mono: "JetBrains Mono", monospace; --radius-default: 0.5rem; } @utility container { margin-inline: auto; padding-inline: 2rem; }
Comment lines removed to keep it short. JetBrains Mono gets quotes because the name has a space.
Input: Example: Container + screens (adds xs 475px and 3xl 1920px), v4
Result: --breakpoint-xs: 29.6875rem; --breakpoint-3xl: 120rem; ... @utility container { margin-inline: auto; padding-inline: 1.5rem; }
The five defaults are unchanged, so only the two extra breakpoints are written, converted from px to rem.
Input: Example: Custom fonts + spacing, v4
Result: --font-sans: "Plus Jakarta Sans", sans-serif; --font-display: "Cal Sans", sans-serif; --font-mono: "Fira Code", monospace; --spacing-18: 4.5rem; --spacing-88: 22rem; --spacing-128: 32rem;
Only the font and spacing lines of the @theme block are shown.
Input: Prefix tw-, Dark Mode media, v4
Result: @import "tailwindcss" prefix(tw); /* Prefixed classes are written like variants: tw:flex tw:hover:bg-primary */ /* dark: follows prefers-color-scheme, which is the v4 default, so nothing to configure */
The hyphen is stripped because v4 prefixes are letters and digits only. First four lines of the output.
Input: Color key Brand Blue with #1d4ed8, v4
Result: --color-brand-blue: #1d4ed8;
Keys are lowercased and spaces become hyphens, so the class is bg-brand-blue.
Input: Defaults, v3
Result: module.exports = { darkMode: "class", content: [ ...3 globs ], theme: { screens: { "sm": "640px", ... "2xl": "1536px" }, container: { center: true, padding: "2rem" }, extend: { colors: { "primary": "#3b82f6", ... }, fontFamily: { "sans": ["Inter", "system-ui", "sans-serif"], ... }, borderRadius: { DEFAULT: "0.5rem" }, }, }, plugins: [], };
Condensed onto fewer lines. screens sits outside extend, so it replaces the default breakpoints.

04Common use cases

  • Writing the @theme block for a fresh Next.js or Vite project on Tailwind v4
  • Turning a brand guide's named colors into --color-* tokens like primary, danger and background
  • Adding the class-based dark variant so a theme toggle that sets .dark on html works
  • Checking how v3 settings such as screens, container.center and borderRadius.DEFAULT map to v4 CSS during an upgrade
  • Converting px breakpoints like 475px and 1920px into rem so they sort correctly next to Tailwind's defaults
  • Adding a prefix such as tw to avoid class clashes when Tailwind runs beside another CSS framework
  • Producing a v3 tailwind.config.js for a legacy project that cannot upgrade yet

05Tips

  • Every --color-* in @theme is also a normal CSS custom property, so var(--color-primary) works in plain CSS, inline styles and SVG fills.
  • Want only your own palette? Add --color-*: initial; at the top of the @theme block to clear Tailwind's built-in colors.
  • v4 skips gitignored files and node_modules when it scans for class names. Add an @source line for a component package that lives in node_modules.
  • The tool's v4 output turns borderRadius.DEFAULT into --radius-default, which gives you rounded-default rather than plain rounded. Rename it to suit your codebase.
  • Mid-migration, @config "./tailwind.config.js" lets v4 load your old JavaScript config while you move tokens over one at a time.

06Related concepts

Tailwind CSS v4, @theme, CSS variables, dark mode, design tokens.

Frequently Asked Questions

What is Tailwind Config Generator?

Tailwind Config Generator is a free, browser-based developer tool on AIDToolStack. Generate tailwind.config.js from settings It requires no installation or sign-up and works entirely in your browser.

Is Tailwind Config Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Tailwind Config Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe