Tailwind CSS Converter
Convert between plain CSS and Tailwind CSS utility classes instantly. Bidirectional, free, and runs entirely in your browser.
No data sent to any server — 100% client-side conversion
Tailwind classes will appear here...FAQ
Q. Which Tailwind version does this follow?
A. Tailwind CSS v4. Class names follow the v4 scale, for example 2px radius is rounded-xs and the small shadow is shadow-xs. Results were checked against the tailwindcss v4.2 compiler.
Q. What happens to values that are not on Tailwind's scale?
A. They become arbitrary values, for example padding: 7px becomes p-[7px] and filter: blur(4px) becomes [filter:blur(4px)]. Even pixel values on the 4px grid use the v4 spacing scale, e.g. 18px becomes 4.5.
Q. Are media queries and nested rules converted?
A. No. Only plain rules and bare declarations are converted. Convert the rules inside a media query separately and add a variant such as md: yourself.
Q. Can I paste the result straight into production code?
A. Use it as a starting point. Check that the classes fit your design system, especially when the output contains arbitrary values or you use a custom theme.
Related tools
Common CSS to Tailwind Patterns
Quick reference table for the most frequently used CSS properties and their Tailwind CSS equivalents.
| Category | CSS | Tailwind |
|---|---|---|
| Layout | display: flex | flex |
| Layout | display: grid | grid |
| Layout | display: none | hidden |
| Layout | display: block | block |
| Layout | position: relative | relative |
| Layout | position: absolute | absolute |
| Layout | position: fixed | fixed |
| Layout | position: sticky | sticky |
| Flexbox | flex-direction: column | flex-col |
| Flexbox | justify-content: center | justify-center |
| Flexbox | justify-content: space-between | justify-between |
| Flexbox | align-items: center | items-center |
| Flexbox | flex-wrap: wrap | flex-wrap |
| Flexbox | flex: 1 1 0% | flex-1 |
| Flexbox | gap: 1rem | gap-4 |
| Spacing | padding: 1rem | p-4 |
| Spacing | padding: 0.5rem 1rem | px-4 py-2 |
| Spacing | margin: 0 auto | mx-auto |
| Spacing | margin-top: 1rem | mt-4 |
| Spacing | margin-bottom: 2rem | mb-8 |
| Sizing | width: 100% | w-full |
| Sizing | height: 100% | h-full |
| Sizing | max-width: 80rem | max-w-7xl |
| Sizing | min-height: 100vh | min-h-screen |
| Typography | font-size: 0.875rem | text-sm |
| Typography | font-size: 1.25rem | text-xl |
| Typography | font-size: 1.5rem | text-2xl |
| Typography | font-weight: 700 | font-bold |
| Typography | font-weight: 600 | font-semibold |
| Typography | text-align: center | text-center |
| Typography | text-transform: uppercase | uppercase |
| Typography | line-height: 1.5 | leading-normal |
| Borders | border-radius: 0.5rem | rounded-lg |
| Borders | border-radius: 9999px | rounded-full |
| Borders | border-width: 1px | border |
| Borders | border-style: solid | border-solid |
| Effects | box-shadow: 0 1px 3px ... | shadow-sm |
| Effects | box-shadow: 0 10px 15px ... | shadow-lg |
| Effects | opacity: 0.5 | opacity-50 |
| Interactivity | cursor: pointer | cursor-pointer |
| Interactivity | overflow: hidden | overflow-hidden |
| Interactivity | user-select: none | select-none |
| Transitions | transition-property: all | transition-all |
| Transitions | transition-duration: 300ms | duration-300 |
Why Use a Tailwind CSS Converter?
What is Tailwind CSS?
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs without writing traditional CSS. Instead of writing display: flex; justify-content: center;, you simply add flex justify-center as CSS classes directly in your HTML. This approach speeds up development, reduces CSS file size through purging unused styles, and makes it easy to maintain consistent designs across large projects.
Why Convert CSS to Tailwind?
Converting existing CSS to Tailwind utility classes is one of the most common tasks when migrating a project to Tailwind CSS. If you have an existing codebase with traditional stylesheets, a CSS to Tailwind converter helps you quickly translate your styles into utility classes. This is especially useful when refactoring legacy code, onboarding new team members who are learning Tailwind, or when you find a CSS snippet online and want to use it in your Tailwind project.
Why Convert Tailwind to CSS?
The reverse direction is equally valuable. Sometimes you need to understand what CSS a Tailwind class actually generates, or you need to extract styles from a Tailwind project into plain CSS for use in a non-Tailwind environment. A Tailwind to CSS converter lets you quickly see the underlying CSS properties for any combination of utility classes. This is helpful for debugging, learning, and for projects that need to support both Tailwind and traditional CSS workflows.
How This Tool Works
This Tailwind CSS converter runs entirely in your browser. It uses a comprehensive mapping dictionary covering the most common CSS properties and their Tailwind equivalents, including layout, spacing, typography, colors, borders, shadows, flexbox, grid, and more. Simply paste your CSS or Tailwind classes in the input panel, and the converted output appears instantly. The converter handles plain selectors and padding/margin shorthands. Values that are not on Tailwind's scale become arbitrary values such as p-[7px], and properties without a named utility become arbitrary properties such as [filter:blur(4px)]. Media queries and nested rules are not converted.
Supported Properties
The converter supports over 60 of the most commonly used CSS properties, including display, position, padding, margin, width, height, font-size, font-weight, color, background-color, border-radius, box-shadow, flexbox properties like justify-content and align-items, grid properties like grid-template-columns and col-span, overflow, opacity, cursor, z-index, transitions, and many more. Output follows Tailwind CSS v4 class names (for example rounded-xs and shadow-xs) and maps pixel and rem values to the v4 spacing scale, where 1 unit is 0.25rem (4px).
Tips for Using the Converter
- You can paste full CSS rules with selectors, or just bare property declarations without selectors.
- Use the mode toggle button to switch between CSS-to-Tailwind and Tailwind-to-CSS directions.
- Click the Copy button to quickly copy the output to your clipboard.
- Check the reference table below the converter for common patterns you can memorize over time.
- For responsive designs, remember that Tailwind uses prefix modifiers like
sm:,md:, andlg:instead of media queries.