How to use the converter
- Choose a direction: Tailwind → CSS or CSS → Tailwind.
- Paste your input: a class list, or one CSS rule’s declarations.
- For Tailwind → CSS, set the selector for the generated rules (for example
.card). - Read the result and the list of anything not converted.
- Copy or download the output.
What’s supported
- Layout: display, position, inset, z-index, overflow and object-fit.
- Flex and grid: direction, wrap, grow and shrink, basis, order, alignment,
grid-cols-Nand spans. - Spacing and sizing: padding, margin (including negative values), gap, width, height, min/max sizes and fractions.
- Typography: sizes with line heights, weights, leading, tracking, alignment, transforms, decoration and truncate.
- Borders and effects: widths, styles, radius, shadows and opacity.
- Colors: black, white, transparent, current and arbitrary values, with opacity modifiers.
- Arbitrary values and properties:
w-[calc(100%-2rem)],[mask-type:luminance].
How it works
The converter parses your CSS into rules and declarations, then maps each declaration to the matching Tailwind utility, such as padding: 1rem to p-4. Values that don’t match the default scale become arbitrary values like p-[18px]. Hover, focus, dark-mode and media-query rules become variant prefixes such as hover: and md:. Palette color names aren’t guessed, because they differ between Tailwind versions, so colors are written as arbitrary values. Anything it can’t convert is listed rather than dropped silently.
Worked examples
Example 1: leaving Tailwind for one component
Load Card: the converter produces a base rule, a :hover rule for the larger shadow, and a (min-width: 768px) rule for the wider padding. Paste them into a regular stylesheet.
Example 2: adopting Tailwind gradually
Load Card CSS in CSS → Tailwind mode. Display, gaps, padding, radius and the shadow map to standard utilities, so you can replace a hand-written rule with classes.
Example 3: custom values
Load Custom CSS. Values without an exact utility, such as 3.25rem padding or backdrop-filter, become arbitrary values. Consider adding them to your theme if you use them often.
Common mistakes
- Expecting exact palette colors. Convert palette names to arbitrary hex values first.
- Copying classes with plugins. Plugin utilities (typography, forms) aren’t part of the core set.
- Forgetting variant order.
md:hover:andhover:md:both work here, but keep one convention in your code.
Why convert at all?
Common reasons include moving a component into a project without Tailwind, writing an email template where classes aren’t available, documenting what a utility actually does, or learning Tailwind by comparing classes with the CSS you already know. Whatever the reason, review the output once and keep it in version control so changes are easy to track.