html69// dev utilities

Tailwind to CSS Converter: Turn Utility Classes into Clean Vanilla CSS

Tailwind to CSS Converter

Utility classes are a joy when you are building fast—until you need to hand styles off to a vanilla CSS stylesheet, debug what a long class string actually compiles down to, or paste styles into a component that does not use Tailwind at all. Our Tailwind to CSS Converter takes a string of Tailwind utility classes and turns it straight into readable, standard CSS rules in one click.

Paste classes, grab standard CSS

Drop in any combination of layout, spacing, typography, color, flexbox, or grid utilities like flex items-center justify-between gap-4 px-6 py-3 rounded-lg bg-slate-900 text-white. The converter translates each utility into its real CSS property and value so you can copy-paste clean rules straight into your .css file or <style> block.

Going the other direction?

If you have legacy CSS rules and want utility classes instead, jump over to our CSS to Tailwind Converter. Both tools share the exact same privacy rule: everything runs 100% locally in your browser with zero server uploads.

How to Convert Tailwind to CSS Manually (No Tool Needed, Zero Magic)

Using an instant converter is great when you have a 15-class button staring at you and five minutes before a standup. Still, knowing how to decode Tailwind utilities into plain CSS by hand is a superpower—especially when you are reading unfamiliar code or debugging spacing quirks in DevTools.

1. Read the Class Pattern (Prefix + Scale)

Most Tailwind utilities follow a predictable formula: property-value. Once you spot the pattern, translating them feels less like memorization and more like reading shorthand.

Take this common card header:

HTML

<div class="flex items-center justify-between gap-4 p-6 bg-white border border-slate-200 rounded-xl">
  Header
</div>

Break it down piece by piece into vanilla CSS:

CSS

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem; /* 4 * 0.25rem = 16px */
  padding: 1.5rem; /* 6 * 0.25rem = 24px */
  background-color: #ffffff;
  border-width: 1px;
  border-style: solid;
  border-color: #e2e8f0;
  border-radius: 0.75rem; /* 12px */
}

2. Master the 0.25rem Spacing Math

Here is the secret that unlocks half of Tailwind's spacing scale: 1 spacing unit equals 0.25rem (4px at the default 16px root font size).

Multiply the number after p-, m-, gap-, w-, or h- by 0.25rem:

spacing

p-1    →  padding: 0.25rem;     /* 4px */
p-2    →  padding: 0.5rem;      /* 8px */
p-4    →  padding: 1rem;        /* 16px */
mt-6   →  margin-top: 1.5rem;   /* 24px */
gap-8  →  gap: 2rem;            /* 32px */

Directional shortcuts map cleanly too:

directions

px-4     →  padding-left: 1rem; padding-right: 1rem;
py-2     →  padding-top: 0.5rem; padding-bottom: 0.5rem;
mx-auto  →  margin-left: auto; margin-right: auto;

3. Translate Responsive Prefixes (sm:, md:, lg:) into Media Queries

When you see a colon like md:grid-cols-3 or lg:text-xl, the prefix is simply a min-width media query wrapping the regular CSS rule:

breakpoints

sm:  →  @media (min-width: 640px)
md:  →  @media (min-width: 768px)
lg:  →  @media (min-width: 1024px)
xl:  →  @media (min-width: 1280px)

For example, grid grid-cols-1 md:grid-cols-3 gap-6 translates manually to:

CSS

.feature-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

4. Handle State Modifiers (hover:, focus:) and Arbitrary Values ([...])

State prefixes map directly to CSS pseudo-classes, while square brackets let you drop in raw values:

HTML

<button class="bg-blue-600 hover:bg-blue-700 focus:outline-none w-[240px]">
  Save
</button>

Written out in plain CSS:

CSS

.save-btn {
  background-color: #2563eb;
  width: 240px;
}

.save-btn:hover {
  background-color: #1d4ed8;
}

.save-btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

5. Inspect Computed CSS Right Inside Browser DevTools

If a project is already running Tailwind in your browser, you can also let the browser hand you the compiled rules:

  1. Right-click the element and choose Inspect.
  2. Look at the Styles pane in DevTools—each Tailwind class appears with its exact generated CSS properties underneath.
  3. Copy the declarations you need into your stylesheet and group them under a semantic class name.

Quick Cheat Sheet for Everyday Utilities

Tailwind ClassVanilla CSS Equivalent
flex / grid / hiddendisplay: flex; / display: grid; / display: none;
items-centeralign-items: center;
justify-betweenjustify-content: space-between;
text-sm / text-base / text-lgfont-size: 0.875rem; / 1rem; / 1.125rem;
font-semibold / font-boldfont-weight: 600; / 700;
rounded-md / rounded-fullborder-radius: 0.375rem; / 9999px;
shadow-smbox-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);

When you are staring at a wall of 20 utility classes and do not feel like doing 0.25rem multiplication in your head, paste the whole string into our Tailwind to CSS Converter—and get clean, ready-to-use CSS right inside your browser.

← All blog posts