What is the CSS to Tailwind Converter?
Convert CSS properties to Tailwind CSS utility class equivalents. Speed up migration from handwritten CSS to Tailwind.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the CSS to Tailwind Converter
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Paste your CSS rule
Paste a CSS declaration block (the property-value pairs inside {}). The tool converts each property to its Tailwind equivalent.
Review the output
Some CSS values do not have a direct Tailwind equivalent and will be shown as arbitrary values: [value]. Review these for accuracy.
Copy and paste into HTML
Add the Tailwind class string to your HTML element's class attribute.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
<!-- Input CSS -->
<!--
.card {
display: flex;
flex-direction: column;
gap: 16px;
padding: 24px;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
-->
<!-- Tailwind classes equivalent -->
<div class="flex flex-col gap-4 p-6 bg-white rounded-xl shadow-sm">
<!-- content -->
</div>Tailwind uses a default spacing scale where 1 unit = 4px. padding: 24px becomes p-6 (6 x 4px = 24px). gap: 16px becomes gap-4 (4 x 4px = 16px).
Ready-to-use CSS patterns
Drop any of these straight into your project — no modifications needed.
Hover and focus states
Pseudo-class rules become prefixed utilities on the same element.
/* CSS */
.btn { background: #2563eb; }
.btn:hover { background: #1d4ed8; }
.btn:focus-visible { outline: 2px solid #93c5fd; }
<!-- Tailwind -->
<button class="bg-blue-600 hover:bg-blue-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-300">Responsive rules
Mobile-first: unprefixed classes apply everywhere, md: and lg: override from that breakpoint up.
/* CSS */
.grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, 1fr); } }
<!-- Tailwind -->
<div class="grid grid-cols-1 md:grid-cols-3">Common mistakes & how to fix them
A few habits trip people up. Here is what to watch for — and the exact fix.
Converting component CSS line by line
Long class strings repeated on every instance of a component become hard to maintain.
Fix: Convert once, then keep the classes in a single component (React, Vue, Blade) or, sparingly, an @apply rule.
Losing the cascade order
In CSS a later rule can override an earlier one; in Tailwind two conflicting utilities on one element are resolved by stylesheet order, not class order.
Fix: Keep only one utility per property on an element, or use a helper such as tailwind-merge when classes are combined dynamically.
Expecting a 1:1 CSS to Tailwind conversion
Tailwind's spacing scale, colour palette, and breakpoints are opinionated. Custom values (non-scale colours, arbitrary spacing) become [arbitrary] classes.
Fix: Use the converter for rough migration. Review arbitrary values and either add them to tailwind.config.js as custom tokens or refactor to the nearest Tailwind scale value.
Pro tips for better results
Tailwind arbitrary values [value] are an escape hatch, not a pattern
Frequent arbitrary values (bg-[#0071e3], p-[13px]) defeat the purpose of a design system. Add frequently used values to tailwind.config.js theme extension instead.
Frequently asked questions
From the blog
Read more →CSS clamp() and Fluid Typography: Stop Writing Font-Size Media Queries (2026)
Learn how CSS clamp() creates type that scales smoothly between screen sizes with a single line, the formula behind it, and how to build a fully fluid type scale without media queries.
CSS Grid vs Flexbox: Which Should You Use? (2026)
CSS Grid vs Flexbox, settled. Here's a senior dev's honest breakdown of when to use each, with real code examples, a comparison table, and no hedging.
CSS Animations: A Practical Guide to Keyframes and Transitions (2026)
Learn the difference between transitions and keyframe animations, how to write @keyframes, the properties worth animating for 60fps, and easing that actually looks good.