Bootstrap to Tailwind converter

Convert Bootstrap to Tailwind

Paste HTML that uses Bootstrap and get the same markup with Tailwind classes: grid, spacing, flex, text, buttons and more.

Bootstrap HTML

Tailwind HTML

<nav class="relative flex items-center justify-between py-2 flex-wrap lg:flex-nowrap lg:justify-start bg-gray-100 px-4">
  <a class="mr-4 py-1 text-xl whitespace-nowrap no-underline text-inherit font-bold" href="#">Acme</a>
  <button class="lg:hidden rounded-md border border-black/15 px-3 py-1 text-xl leading-none" type="button" data-bs-toggle="collapse" data-bs-target="#menu">
    <span class="inline-block h-[1.5em] w-[1.5em] align-middle bg-center bg-no-repeat bg-[length:100%]"></span>
  </button>
  <div class="hidden [&.show]:block lg:!flex lg:basis-auto basis-full grow items-center" id="menu">
    <ul class="lg:flex-row lg:gap-4 flex flex-col list-none pl-0 mb-0 ms-auto">
      <li><a class="block px-4 py-2 text-blue-600 no-underline transition-colors hover:text-blue-800 active" href="#">Home</a></li>
      <li><a class="block px-4 py-2 text-blue-600 no-underline transition-colors hover:text-blue-800" href="#">Pricing</a></li>
    </ul>
  </div>
</nav>

<div class="w-full mx-auto px-3 sm:max-w-[540px] md:max-w-[720px] lg:max-w-[960px] xl:max-w-[1140px] 2xl:max-w-[1320px] py-12">
  <div class="flex flex-wrap -mx-3 [&>*]:px-3 gap-y-6 items-center">
    <div class="w-full shrink-0 px-3 md:w-1/2 md:flex-none">
      <h1 class="text-5xl leading-tight font-bold mb-4">Ship faster</h1>
      <p class="text-xl font-light text-gray-500">Everything you need to launch, in one place.</p>
      <a href="#" class="inline-block border text-center align-middle font-normal no-underline transition-colors select-none focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-blue-600/25 disabled:pointer-events-none disabled:opacity-65 border-blue-600 bg-blue-600 text-white hover:border-blue-700 hover:bg-blue-700 px-4 py-2 text-xl rounded-lg me-2">Get started</a>
      <a href="#" class="inline-block border text-center align-middle font-normal no-underline transition-colors select-none focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-blue-600/25 disabled:pointer-events-none disabled:opacity-65 border-gray-500 text-gray-500 bg-transparent hover:bg-gray-500 hover:text-white px-4 py-2 text-xl rounded-lg">Learn more</a>
    </div>
    <div class="w-full shrink-0 px-3 md:w-1/2 md:flex-none">
      <div class="relative flex min-w-0 flex-col break-words rounded-md border border-black/[0.175] bg-white bg-clip-border shadow-sm">
        <div class="flex-auto p-4">
          <h5 class="mb-2 text-xl font-medium">Join the waitlist</h5>
          <form>
            <label for="email" class="mb-2 inline-block">Email</label>
            <input type="email" class="block w-full appearance-none rounded-md border border-gray-300 bg-white bg-clip-padding px-3 py-1.5 text-base font-normal leading-normal text-gray-900 transition-[border-color,box-shadow] placeholder:text-gray-500 focus:border-blue-300 focus:outline-none focus:ring-4 focus:ring-blue-600/25 disabled:bg-gray-100 mb-4" id="email" placeholder="you@example.com">
            <button type="submit" class="inline-block rounded-md border px-3 py-1.5 text-center align-middle text-base font-normal leading-normal no-underline transition-colors select-none focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-blue-600/25 disabled:pointer-events-none disabled:opacity-65 border-green-700 bg-green-700 text-white hover:border-green-800 hover:bg-green-800 w-full">Sign up</button>
          </form>
          <div class="relative rounded-md border px-4 py-4 bg-cyan-50 text-cyan-800 border-cyan-200 mt-4 mb-0 text-sm">No spam, ever.</div>
        </div>
      </div>
    </div>
  </div>
</div>
  • Converted 25 class attributes. Everything else in the markup is unchanged.
  • navbar-toggler-icon gets its hamburger from Bootstrap's CSS, so put an SVG icon inside the toggler button.
  • Bootstrap's breakpoints (576, 992, 1200, 1400px) map to Tailwind's nearest (640, 1024, 1280, 1536px), and responsive font sizes, shadows and large radii use the closest Tailwind step.
  • Kept active: Bootstrap's JavaScript uses these state and component classes. Replace them when you move those components off Bootstrap JS.
  • Free, no sign-up
  • Runs in your browser
  • Your code never leaves your device

How to use it

How to use the Bootstrap to Tailwind tool

Free, with no sign-up. Everything happens in your browser.

  1. 01

    Paste your Bootstrap HTML

    A component, a section or a whole page using Bootstrap 4 or 5 classes. Your own classes, attributes and text are left alone.

  2. 02

    Check the notes

    The converted HTML updates as you type. The notes list classes kept for Bootstrap's JavaScript and any Bootstrap class without a Tailwind match.

  3. 03

    Copy it into your project

    Copy the HTML or download it, then remove Bootstrap's CSS once every page is converted. Turning it into React next? Run it through HTML to JSX.

Guide

How Bootstrap classes map to Tailwind

Bootstrap gives you components and a set of utilities; Tailwind gives you utilities only. The converter swaps Bootstrap's utilities for their Tailwind twins and expands each component class into the utilities that recreate it.

Spacing: a different scale

Bootstrap's spacers go from 0 to 5, while Tailwind's scale counts quarter rems. So p-3 (1rem) becomes p-4, mt-4 (1.5rem) becomes mt-6 and mb-5 (3rem) becomes mb-12. Classes 0, 1 and 2 happen to match.

Bootstrap 5's logical ms- and me- (margin start and end) map to Tailwind's ms- and me-, and Bootstrap 4's ml- and mr- to ml- and mr-.

Bootstrap
<div class="p-3 mt-4 mb-5 ms-auto">
Tailwind
<div class="p-4 mt-6 mb-12 ms-auto">

Responsive infixes become prefixes

Bootstrap puts the breakpoint in the middle of the class, Tailwind puts it at the front: d-md-flex becomes md:flex, text-lg-start becomes lg:text-left and mt-md-3 becomes md:mt-4.

The breakpoints aren't identical. Bootstrap's sm, lg, xl and xxl are 576, 992, 1200 and 1400px; Tailwind's sm, lg, xl and 2xl are 640, 1024, 1280 and 1536px. md is 768px in both. Layouts switch a little later, which rarely matters, but you can match Bootstrap exactly by setting screens in your Tailwind config.

Bootstrap
<div class="d-none d-md-flex justify-content-between">
Tailwind
<div class="hidden md:flex justify-between">

The 12-column grid

Rows become flex containers with Bootstrap's negative margins, and columns become fractional widths with the same padding, so the gutters line up as before: col-6 is w-1/2, col-md-4 is md:w-1/3, and a plain col grows to fill the space.

Gutter classes like g-4 set the row's margin and its columns' padding together, and columns without a base size stack at full width on small screens, just like Bootstrap.

Bootstrap
<div class="row">
  <div class="col-md-8">…</div>
  <div class="col-md-4">…</div>
</div>
Tailwind
<div class="flex flex-wrap -mx-3">
  <div class="w-full shrink-0 px-3 md:w-2/3 md:flex-none">…</div>
  <div class="w-full shrink-0 px-3 md:w-1/3 md:flex-none">…</div>
</div>

Components expand into utilities

Classes like btn, card, alert, badge, form-control and navbar don't exist in Tailwind, so each one becomes the utilities that style it. Modifiers are merged in properly: btn btn-primary btn-lg gets the large padding and the primary colors, not a clash between the two sizes.

Theme colors map to Tailwind's palette: primary to blue-600, success to green-700, danger to red-600, warning to amber-400 and secondary to gray-500. Swap them for your brand's colors with a find and replace.

Bootstrap
<a class="btn btn-primary btn-lg">Get started</a>
Tailwind
<a class="inline-block border … border-blue-600 bg-blue-600
   text-white hover:bg-blue-700 px-4 py-2 text-xl rounded-lg">
  Get started
</a>

Bootstrap's JavaScript components

Modals, dropdowns, collapses, carousels and accordions are driven by Bootstrap's JavaScript, which looks for class names like modal and dropdown-toggle and toggles show and active. Those classes are kept so the components keep working while you migrate, and collapse becomes hidden with a [&.show]:block override so menus open when the script adds show.

When you're ready to drop Bootstrap's JavaScript, replace those components with a headless library such as Headless UI or Radix, or a few lines of your own script.

Default styles: Reboot versus Preflight

Bootstrap's Reboot gives headings and paragraphs a bottom margin and sizes h1 to h6 for you. Tailwind's Preflight resets them all to zero, so text written without classes sits tighter after the switch. Add mb-4 to paragraphs that need the space, or the typography plugin's prose class to long-form content.

What it handles

Built for real-world code

The details that usually need fixing by hand, done for you.

  • Checked against real Tailwind

    Every class the converter writes is one Tailwind 3 generates, and our tests compile its output with Tailwind to keep it that way.

  • Only class attributes change

    Text, comments, scripts, data attributes and your own class names stay exactly as written, so the diff is easy to review.

  • Bootstrap 4 and 5

    Covers both versions' utilities, grid, buttons, cards, alerts, badges, forms, input groups, navbars, tables, list groups and pagination.

  • Private by design

    The conversion runs in your browser. Your HTML isn't uploaded, stored or logged anywhere.

Website to Code

Moving a whole Bootstrap site?

Point Website to Code at a live page and get it back as clean, editable Tailwind code, ready to refine by chat and download.

FAQ

Questions about Bootstrap to Tailwind

Something else on your mind? Send us a message.

Yes. It's free with no sign-up and no limits, and it runs entirely in your browser.

More free tools

Keep going

More converters for HTML, React and Tailwind.