CSS to Tailwind Converter

Paste CSS rules or declarations and get the equivalent Tailwind utility classes for each selector — including hover: states and arbitrary values like p-[13px].

Runs in your browserUpdated

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the CSS to Tailwind Converter

  1. Paste CSS rules (with selectors) or just declarations.
  2. Read the class list generated for each selector.
  3. Copy the classes into your HTML or JSX; review arbitrary values and replace them with theme tokens where it makes sense.

How values are mapped

Tailwind’s default spacing scale uses steps of 0.25 rem (4 px), so padding: 16px becomes p-4 and margin: 0 auto becomes my-0 mx-auto. Values that are not on the scale use arbitrary-value syntax: padding: 13px → p-[13px]. Typography, radii and weights map to their named steps:

CSSTailwind
display: flex; flex-direction: columnflex flex-col
gap: 16pxgap-4
font-size: 24px; font-weight: 700text-2xl font-bold
border-radius: 12pxrounded-xl
background-color: #7c5cffbg-[#7c5cff]
width: 100%w-full
.btn:hover { color: #fff }hover:text-white

Limits to know

  • Colours become arbitrary values; map them to your theme palette (for example bg-violet-500) afterwards — the CSS variables to Tailwind tool helps define a theme.
  • Properties without a utility are written as arbitrary properties: [mask-image:url(...)].
  • Media queries, complex selectors and animations need manual translation to md:, group-hover: and theme config.
  • !important becomes the ! prefix.

For one-off values, the Tailwind arbitrary value generator builds individual classes, and the Tailwind colour generator creates full palettes.

Tools that pair well with the CSS to Tailwind Converter

  • PX to REM Converter — Convert between pixels, rem and em with your own root font size — or paste a whole stylesheet and convert every px value in one go.
  • CSS Formatter — Turn a minified stylesheet into readable CSS with one property per line and properly nested @media blocks.
  • CSS Gradient Generator — Design a gradient visually — drag colour stops, change the angle or type, start from a preset — and copy production-ready CSS with a solid fallback colour.
  • Box Shadow Generator — Stack multiple shadow layers, tweak offsets, blur, spread and opacity on a live card, then copy the box-shadow or text-shadow CSS.

Frequently asked questions

Does it support Tailwind v4?
Yes. The generated utilities and arbitrary values work in Tailwind v3 and v4.
Why are colours written as bg-[#hex]?
Exact colours are kept as arbitrary values so nothing changes visually. Replace them with your theme colours when you have a palette.
Can it convert media queries?
Not automatically. Convert the rules inside a media query separately and add the right responsive prefix, such as md:.

Related tools