CSS ↔ Tailwind Converter.
Map CSS rules to Tailwind CSS v3 classes, or expand Tailwind classes back into plain CSS.
Runs in your browserAbout CSS ↔ Tailwind Converter
The CSS ↔ Tailwind Converter maps ordinary CSS onto the default Tailwind CSS v3 theme and back. Values are matched against the real scales: 16px or 1rem becomes 4 on the spacing scale, 14px font size becomes text-sm, #3b82f6 becomes blue-500 from the 242-color palette, an rgba() of a palette color becomes a modifier such as red-500/50, 6px radius becomes rounded-md and the default shadow strings become shadow-sm or shadow-lg. Shorthands are expanded and folded back into the shortest utilities, so margin: 0 auto gives my-0 mx-auto and padding: 8px 16px gives py-2 px-4. Selectors ending in :hover, :focus, :disabled, ::before and similar become variants, and @media (min-width: 768px) becomes md:, with min-[…] and max-[…] variants for other widths. Values that are not on a scale use Tailwind's arbitrary value syntax such as w-[13px], and properties Tailwind has no utility for become arbitrary properties like [mask-type:luminance]; the notes list each of these so you can decide whether to add them to your theme. In the other direction paste a class list or HTML with class attributes and get the CSS those utilities generate, grouped into base, pseudo-class and media rules. Classes from plugins or a customized theme cannot be known and are listed as not converted. Remember that text-sm also sets a line height, so check typography after converting. Everything runs in your browser.
How to Use
- Paste CSS rules or Tailwind classes and choose the direction.
- For Tailwind to CSS, optionally set the selector used in the output.
- Copy the classes or CSS and review the notes for arbitrary values.
Frequently Asked Questions
Which Tailwind version is used?
Tailwind CSS v3.4 with the default theme - its spacing scale, font sizes, radii, shadows, breakpoints and the full default color palette. Custom theme values are emitted as arbitrary values.
What happens to CSS that has no Tailwind utility?
It becomes an arbitrary property such as [transition:all_150ms_ease], which Tailwind v3 compiles as written. Each one is listed in the notes.
Why does my converted text look slightly different?
Tailwind's text-* size utilities also set a line height. If your CSS set only the font size, add a leading-* class to match the original.
Does it run offline?
Yes. Both directions run in your browser with no network requests.
Related Tools
Turn one brand color into a Tailwind 50–950 palette, as v4 @theme, v3 config, CSS variables or SCSS.
Beautify CSS with one declaration per line or minify it safely, including nested rules and media queries.
Convert between HEX, RGB, and HSL formats.
Convert px, rem, em, pt and % with your root font size, or rewrite every px in a CSS block as rem.
Convert HTML into valid React JSX - className, htmlFor, style objects, self-closing tags and safe text.
Design soft, layered or inset CSS box-shadows with a live preview and Tailwind output.