Zero Signup ToolsFree browser tools

Developer Tools

CSS to Tailwind Converter

Paste any CSS rule or declaration list and get the equivalent Tailwind utility classes. Per-declaration breakdown and an HTML snippet.

Examples

Combined Tailwind classes

All non-variant utilities merged into a single class string, deduplicated.

flex flex-col p-6 bg-slate-800 text-slate-100 rounded-2xl border border-slate-700 shadow-lg gap-4

HTML snippet

Drop-in element with the merged Tailwind class string.

<div class="flex flex-col p-6 bg-slate-800 text-slate-100 rounded-2xl border border-slate-700 shadow-lg gap-4">
  ...
</div>

Per-rule classes

One Tailwind class string per CSS selector you provided.

.card

flex flex-col p-6 bg-slate-800 text-slate-100 rounded-2xl border border-slate-700 shadow-lg gap-4

Per-declaration breakdown

CSS propertyCSS valueTailwind classes
displayflex
flex
flex-directioncolumn
flex-col
padding24px
p-6
background-color#1e293b
bg-slate-800
color#f1f5f9
text-slate-100
border-radius16px
rounded-2xl
border1px solid #334155
borderborder-slate-700
box-shadow0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)
shadow-lg
gap16px
gap-4

Green chips are exact matches to the Tailwind default scale. Amber chips fell back to a Tailwind arbitrary value like p-[14px] or text-[#bada55] because the CSS value is not in the default theme.

What this tool does

  • Maps CSS properties to Tailwind utilities from the default v3.4 / v4 theme.
  • Recognizes the spacing scale (0.25rem step), color palette (22 hues), font-size scale, border radius and shadow scales, flexbox, grid, and common display, position, and typography properties.
  • Falls back to Tailwind arbitrary values (p-[13px], text-[#bada55], shadow-[...]) when a CSS value is not in the default scale, so nothing silently disappears.
  • Expands margin and padding shorthands into the most specific Tailwind family (p-4, py-4, pt-4, etc.).
  • Reads colors as hex, rgb, or rgba, and emits opacity modifiers like bg-blue-500/50 when an alpha channel is present.
  • Highlights any property the default mapping does not cover so you can decide whether to keep it as plain CSS.

How to use

  1. Paste the CSS into the input. Use a full rule (.card { padding: 16px; color: #3b82f6; }), a bare list of declarations, or just one property: value pair.
  2. Click one of the Examples to load a card, button, hero, typography, or arbitrary-value sample if you want to see how the converter behaves.
  3. Read the Combined Tailwind classes card for the merged class string. Copy it with the Copy classes button.
  4. Edit the HTML tag field to change the wrapping tag in the HTML snippet output (div, button, section, etc.).
  5. Use the Per-rule classes card to copy a separate class string for each CSS selector you provided.
  6. Read the Per-declaration breakdown to see which Tailwind utility each CSS property compiled to. Green chips matched the default scale; amber chips fell back to an arbitrary value.
  7. Check the Notes card for any CSS properties or values that the default mapping does not cover so you can decide whether to keep them as plain CSS.

About this tool

CSS to Tailwind Converter turns a block of CSS declarations into the equivalent Tailwind utility classes. Paste a full rule with a selector and braces, a bare declaration list, or even a single property line, and the tool returns three views: a single merged Tailwind class string ready to drop into class="...", an HTML snippet that wraps the merged classes around the tag you pick, and a per-declaration breakdown that shows which Tailwind utility each CSS property mapped to. It covers the Tailwind v3.4 / v4 default theme: the spacing scale on the 0.25rem step (used for margin, padding, gap, inset, top, right, bottom, left), width and height with the standard keywords (auto, full, screen, min, max, fit) and the percentage to fraction conversion (50% to 1/2, 33% to 1/3, 75% to 3/4), typography (font-size with bundled line-height across the xs to 9xl scale, font-weight by name or numeric value, line-height named tokens, letter-spacing, text-align, text-transform, text-decoration), the complete default color palette (22 hues across 11 shades for text, background, and border, with opacity modifiers like bg-blue-500/50 emitted when the input includes an alpha channel), border width and style and radius (per-side and unified, with the rounded scale matched by name and by rem value), shadow scale matched against the canonical Tailwind v3 / v4 shadow strings, display, position with full inset support, z-index, flexbox (direction, wrap, align-items, justify-content, align-self, gap with row and column variants), grid-template-columns and rows in the repeat(N, minmax(0, 1fr)) idiom that Tailwind ships as grid-cols-N, object-fit and object-position, aspect-ratio with the square and video shortcuts, cursor, user-select, pointer-events, opacity, overflow with axis variants, and a handful of typography niceties like white-space, word-break, and overflow-wrap. Values that are not in the default scale fall back to Tailwind arbitrary values (p-[13px], text-[#bada55], w-[42rem], shadow-[0_4px_8px_rgba(0,0,0,0.2)]), which are highlighted as amber chips in the breakdown so you can tell at a glance what is on-scale and what is custom. Negative lengths become negative utilities (-mt-4 for margin-top: -1rem). Properties the default mapping does not cover (animation, transitions, custom CSS functions) are reported in the Notes card rather than silently dropped. Everything runs in your browser. No code is uploaded.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools