PickCode Add to Chrome
  1. Home
  2. Guides
  3. HTML to Tailwind

How do I convert HTML and CSS to Tailwind?

Updated October 29, 2026

Short answer

Work component by component: for each element, find the rules that actually apply, map them to Tailwind utilities, and put the classes on the element. Drop declarations that just repeat browser defaults. Then delete the old stylesheet rules as you go.

Why automatic conversion often goes wrong

A converter that copies every computed property onto every element produces markup nobody can maintain. One Reddit user described the result: "a simple div ends up being thousands of line of code." The fix is to convert only what differs from the defaults and what the design actually needs.

A good conversion leaves out values the browser already sets (display: block on a div, font-style: normal), skips inherited values on children when the parent sets them, and uses shorthands (px-6 rather than pl-6 pr-6).

A worked example

<!-- Before -->
<style>
  .feature { display: flex; gap: 16px; padding: 24px; border: 1px solid #e5e7eb; border-radius: 12px; }
  .feature h3 { font-size: 18px; font-weight: 600; color: #111827; }
  .feature p { margin-top: 4px; font-size: 14px; color: #6b7280; }
  @media (min-width: 768px) { .feature { padding: 32px; } }
</style>
<div class="feature">
  <div><h3>Fast setup</h3><p>Ready in two minutes.</p></div>
</div>

<!-- After -->
<div class="flex gap-4 rounded-xl border border-gray-200 p-6 md:p-8">
  <div>
    <h3 class="text-lg font-semibold text-gray-900">Fast setup</h3>
    <p class="mt-1 text-sm text-gray-500">Ready in two minutes.</p>
  </div>
</div>

Each rule moves onto the element it styled, the media query becomes md:, and the descendant selectors disappear because the classes now sit on the h3 and p directly.

A conversion checklist

Convert straight from the page with PickCode

  1. Open the page. Your own localhost works too, so you can convert a legacy template in place.
  2. Pick a component. Press Alt Shift C, hover the component, and use ↑ to reach its wrapper.
  3. Copy as Tailwind. Press 1 in the code panel. Classes use the default scale where values fit, with readable breakpoint and hover prefixes.
  4. Replace the old markup. Paste over the original component and delete the stylesheet rules it no longer needs.

Converting markup from a live site

If the HTML is on a site you don't control, you don't have its source CSS in a neat file. You have the rendered page. That is where reading computed styles from the browser helps: the values are already resolved, whatever framework produced them. For pasting single rules, the free CSS to Tailwind converter works too.

Questions

Can I convert a full HTML template in one go?

You can try, but component by component is more reliable. It keeps each paste small enough to check against the original.

What about CSS frameworks like Bootstrap?

Those need a mapping of the framework classes as well. See Bootstrap to Tailwind.

Do I need Tailwind v4 for this?

No. The class names in this guide work in v3 and v4. Theme variables in @theme are v4; v3 uses tailwind.config.js instead.

Should I keep any custom CSS?

Yes, for keyframes, complex selectors and third-party widgets. A short CSS file next to Tailwind is normal.

Sources

  1. Reddit r/tailwindcss: copy elements from any website as Tailwind CSS
  2. Reddit r/tailwindcss: HTML/CSS and Bootstrap to Tailwind converters
  3. Reddit r/tailwindcss: clone any website into Tailwind
  4. Tailwind CSS: responsive design
  5. Tailwind CSS: hover, focus and other states

Copy it in one click

PickCode turns any element into Tailwind, React, Blade or HTML + CSS. Free for 5 elements a day.

Add to Chrome

Related

Quick answers