I Migrated a Bootstrap Page to Tailwind Without Losing My Mind (Here's How)
DEV Community

I Migrated a Bootstrap Page to Tailwind Without Losing My Mind (Here's How)

Let me guess how you got here. You've got a project full of Bootstrap. Somewhere between mb-3 and col-md-6, you decided Tailwind is the future, or your team did, or you just got tired of fighting !important. Now you're staring at 40 HTML files and wondering how long a rewrite will take.

I've been there. The good news is that a lot of the work is mechanical, and mechanical work is exactly what tools are for. In this tutorial I'll walk through the free Bootstrap to Tailwind Converter from AabiTech, show how it works, and be honest about where it stops and you have to take over.

What the tool does

You paste Bootstrap HTML on one side, and it gives you Tailwind HTML on the other. Conversion updates live as you type. A few things I like:

  • Bootstrap 4 and 5 are both selectable as the source.
  • Tailwind CSS 3 and 4 are selectable as the target.
  • It runs in your browser. The page says your HTML is processed locally and isn't uploaded to a conversion endpoint, which is nice if the markup belongs to a client.
  • It doesn't hide what it can't convert. Classes with no verified mapping stay in the output and get flagged, instead of silently disappearing.

That last point is the most important one. A converter that quietly drops classes will cause bugs you find three weeks later. One that says "I'm not sure about this one" is a colleague I'd trust.

Step 1: Paste a real snippet

Don't start with your whole layout. Pick one small, self-contained chunk, like a card or a hero section. Here's a typical Bootstrap 5 one:

<div class="container">
  <div class="row">
    <div class="col-md-6 mb-3">
      <h2 class="text-center fw-bold mb-4">Hello, world</h2>
      <p class="text-muted">A small card-ish thing.</p>
      <a href="#" class="btn btn-primary">Get started</a>
    </div>
  </div>
</div>

Pick Bootstrap 5 as the source and your Tailwind version as the target. Match the source to what you're actually running. The tool says plainly that the version selector doesn't resolve every version-specific difference.

Step 2: Read the output

The tool's output should look something like this (yours may differ in the details):

<div class="container mx-auto px-4">
  <div class="flex flex-wrap">
    <div class="md:w-1/2 mb-4">
      <h2 class="text-center font-bold mb-6">Hello, world</h2>
      <p class="text-gray-500">A small card-ish thing.</p>
      <a href="#" class="btn btn-primary">Get started</a>
    </div>
  </div>
</div>

Notice what happened:

  • fw-bold became font-bold, an easy one-to-one swap.
  • mb-3 became mb-4, and mb-4 became mb-6. That's not a bug. Bootstrap and Tailwind use different spacing scales.
  • btn btn-primary stayed put. That's the "needs review" bucket.

Step 3: Understand the spacing scale

This is where most people get bitten, so here's the cheat sheet. Bootstrap's spacing steps are based on a 1rem spacer, and Tailwind's are based on 0.25rem units:

Bootstrap Size Tailwind (default theme)
mb-1 0.25rem mb-1
mb-2 0.5rem mb-2
mb-3 1rem mb-4
mb-4 1.5rem mb-6
mb-5 3rem mb-12

So the same-looking class means different things. If you ever "fix" a converted file by hand, remember this table.

Step 4: Check the diagnostics panel

Under the editors, the tool breaks recognized classes into three groups:

  • Exact mappings: safe, boring, great.
  • Approximations: close, but verify them visually.
  • Need review: not converted, left for you.

It also shows an "exact mapping coverage" figure. The page itself warns this is a rule-coverage indicator, not a guarantee that the page will render identically. I'd read it the same way: a rough sense of how much hand-work is left, not a quality score.

Step 5: Use the live preview, but don't trust it blindly

There's a preview with Mobile, Tablet and Desktop toggles. It's handy for a quick sanity check, and it runs in a sandboxed frame. Two caveats:

  • It loads Tailwind from a CDN, so you need an internet connection.
  • It uses Tailwind's default theme. If your project has custom colors or breakpoints, the real result can differ.

Treat it as a smoke test, not a sign-off.

The part no converter can do for you

Here's the honest bit. I'd rather you hear it from me than discover it at 11pm before a deploy.

Grid layouts are approximate. Bootstrap's row and col-* classes come with gutters, negative margins and nesting behavior that can't be fully inferred from class names alone. The converter gives you a starting point. Compare the layout side by side.

Components are a different story. btn, card, modal, navbar, dropdowns and accordions rely on Bootstrap's CSS, structure and sometimes JavaScript. There's no single Tailwind utility that replaces them. You'll want to either:

  • build your own reusable component (a <Button />, or @apply in a stylesheet), or
  • reach for a Tailwind component library.

Your config matters. The tool doesn't read your tailwind.config.js or your Bootstrap Sass variables. If you customized either, expect to adjust.

It's not a full-document converter. According to the page, scripts, iframes, objects and embeds are removed from the output. Use it for fragments, and move scripts over yourself. It also isn't an HTML sanitizer, so review the markup before putting it into your app.

My suggested workflow

If I were migrating a real project tomorrow, I'd do this:

  • Convert one component at a time, not whole pages.
  • Paste, convert, and read the diagnostics first.
  • Fix the "need review" items by hand, starting with buttons and cards.
  • Drop the result into the project and look at it in the browser at a few widths.
  • Commit small. Future-you will thank you when something looks off.

A converter won't finish the migration for you. What it does is remove the tedious 70%, the mb-3 to mb-4 busywork, so you can spend your attention on the parts that need judgment.

Wrapping up

The Bootstrap to Tailwind Converter is free, needs no signup, and is upfront about its limits. That honesty is why I'd use it. Try it on one ugly legacy snippet, check the diagnostics, and see how much time it saves.

Have you migrated from Bootstrap to Tailwind? What was the one thing that tripped you up? I'd love to hear it in the comments. Happy migrating! 🚀

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.