Migrating a project from plain CSS to Tailwind CSS or converting a CSS snippet for use in a React component? DevDeck's CSS โ Tailwind Converter parses your CSS rules and maps each property to the equivalent Tailwind utility class โ with smart color handling, spacing scale conversion, and unmapped property annotations.
It's a browser-based tool that takes standard CSS input and outputs equivalent Tailwind utility classes. It handles 120+ CSS properties across layout, typography, colors, spacing, borders, shadows, flexbox, grid, transforms, transitions, and more. Properties that have no direct Tailwind equivalent are annotated as comments so you know exactly what needs manual attention.
Tailwind's utility-first approach speeds up development by reducing context-switching between HTML and CSS files. Converting existing CSS to Tailwind lets you adopt this workflow incrementally โ migrate one component at a time without rewriting everything from scratch. The converter also helps when you're prototyping with CSS and want to translate your work into clean Tailwind classes.
The converter uses a curated mapping table of ~120 CSS properties. Each property has a mapper function that receives the CSS value and returns one or more Tailwind class names. For example, display: flex โ flex, justify-content: center โ justify-center, padding: 8px 16px โ px-4 py-8. Values that don't fit the Tailwind scale (like custom pixel values) use Tailwind's JIT arbitrary value syntax: w-[18px], text-[#ff6600].
Colors are handled specially. The converter recognizes named colors (white, black, red, blueโฆ), hex codes (#fff, #000000, #22cc99โฆ), and RGB/RGBA values. Common hex colors are mapped to their closest Tailwind named class: #fff โ text-white, #22cc99 โ bg-emerald-400, #3b82f6 โ text-blue-500. For unrecognized colors or exact shades, the tool falls back to Tailwind's arbitrary value JIT syntax: text-[#ff6600] or bg-[rgba(34,51,68,0.5)].
Tailwind uses a predefined spacing scale (0.5, 1, 2, 4, 8, 16, 20, 24โฆ rem-based units). The converter maps your px values to the closest scale match: 4px โ 1 (p-1), 8px โ 2 (m-2), 16px โ 4 (gap-4). Values that don't have an exact match in the scale fall back to arbitrary value syntax: w-[18px].
The converter handles CSS shorthand properties intelligently. margin: 10px becomes m-10, but margin: 10px 20px expands to my-10 mx-20, and margin: 10px 20px 30px 40px becomes mt-10 mr-20 mb-30 ml-40. If values repeat, the output is deduplicated โ margin: 10px 20px 10px 20px collapses to my-10 mx-20. The same logic applies to padding.
You're migrating a legacy Bootstrap project to Tailwind. You copy a CSS block like .btn { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 6px; font-weight: 700; } and paste it. The converter returns inline-flex items-center px-4 py-2 rounded-md font-bold โ ready to drop directly into your JSX className. The unmapped section shows any properties that need manual Tailwind equivalents.
Ready to try it?
Yes, completely free with no signup required.
No. All conversion happens locally in your browser. Nothing is sent to any server.
Over 120 properties covering display, flexbox, grid, positioning, sizing, typography, colors, backgrounds, borders, shadows, opacity, transforms, transitions, and more.
They are shown as comments below the output (e.g., /* gap: 12px โ no Tailwind class */) so you know exactly what needs manual attention.
Not yet. The current version converts base CSS properties. Responsive variants (sm:, md:, lg:) and pseudo-classes (:hover, :focus) are on the roadmap.
Common hex colors are mapped to Tailwind named classes (#fff โ white, #22cc99 โ emerald-400). Unrecognized hex values use Tailwind's JIT arbitrary value syntax (text-[#ff6600]).
Yes. Shorthand values are expanded to the correct Tailwind directional classes (margin: 10px 20px โ my-10 mx-20). Duplicate values are collapsed automatically.
DevDeck ยฉ 2023 - 2026
100% client-side โข No data leaves your browser