Toolvito

Works on this device

CSS Framework Converter

Paste utility classes, CSS or SCSS and get the other form. The page converts by rule and tells you what it could not convert. It never guesses a value that only the framework knows.

Paste what you want to convert

Turns classes such as p-4 or d-flex into the CSS they stand for, or into the classes of the other framework.

The class names as they stand in a class attribute, with spaces between them.

Your values are worked out in this browser. They are not sent to a server.

Your converted text will show here

Paste the text, or choose Try an example.

How to use the converter

  1. Choose what you want to convert in the first menu.
  2. Paste the classes, the CSS or the SCSS, or choose Try an example. The result shows as you type.
  3. Read the table under the result. It has one line for each class or declaration, with a note when something was not converted.
  4. Choose Copy text or Download file.

What is converted by rule

  • Spacing: in Tailwind CSS one step is 0.25rem, so p-6 is padding: 1.5rem. In Bootstrap the steps 0 to 5 are 0, 0.25, 0.5, 1, 1.5 and 3 rem, so p-4 is also padding: 1.5rem. Sides (px, mt, ms ...), gap and margins with auto follow the same rule.
  • Sizes: fractions such as w-1/2 (50%), w-full, h-screen, and in Bootstrap w-25 to w-100, vh-100 and the like.
  • Values in square brackets (Tailwind): w-[32rem], bg-[#1da1f2], text-[14px], and a whole declaration such as [mask-type:luminance].
  • Keywords: display, position, the flexbox and grid words, text alignment, font weight, italic, upper and lower case, underline, overflow, float, visibility, opacity, order and z-index.
  • Grid counts (Tailwind): grid-cols-3, col-span-2, row-start-2.
  • Font size classes of Bootstrap: fs-1 to fs-6 are 2.5, 2, 1.75, 1.5, 1.25 and 1 rem.
  • Breakpoints and states: md: and d-md-flex become a @media (min-width: ...) rule; hover:, focus:, first: and the like become a rule with that state; dark: follows the colour scheme of the device.

What is not converted, and why

  • Classes of the theme: colours (bg-blue-500, text-primary), named text sizes (text-lg), corner sizes (rounded-lg), shadows and fonts. Their values stand in a large table of the framework, and this page holds no copy of it. In the direction to Tailwind such a value is written in square brackets.
  • Components: btn, card, navbar and the like are many rules each. A button of one framework has no exact twin in the other.
  • Classes that the framework builds from its own variables: transforms (scale-105), filters, transitions, rings and space-x-4.
  • Grid classes of Bootstrap (row, col-md-6): use the grid choice of this page to make them.
  • Each such class is listed with its reason. Nothing is filled in by guessing.

SCSS to CSS and back

The page reads the part of SCSS that needs no working out: rules inside rules, the parent mark & (as in &:hover and &-title), @media inside a rule, and variables with fixed values. It writes the nested rules out flat and puts the values in.

It is not a Sass compiler. When the text has a mixin, @include, @extend, @use, a function such as darken(), a sum, #{...} or a loop, the page stops, names the line, and writes no CSS at all. The indented Sass syntax and Less are not read.

The other way round, plain CSS is already valid SCSS. The page makes it shorter: rules that follow each other and share the start of their selector are written inside each other. It never changes the order of the rules, so the result gives the same CSS again.

Worked examples

  • Tailwind to CSS: flex items-center gap-4 p-6 w-1/2 md:w-full gives display: flex, align-items: center, gap: 1rem (4 × 0.25rem), padding: 1.5rem (6 × 0.25rem), width: 50%, and width: 100% inside @media (min-width: 768px).
  • Bootstrap to Tailwind: d-flex justify-content-between p-4 w-50 fw-bold gives flex justify-between p-6 w-1/2 font-bold. The step 4 of Bootstrap is 1.5rem, and that is step 6 of Tailwind.
  • CSS to classes: padding: 24px is read as 1.5rem (24 ÷ 16) and becomes p-6 in Tailwind and p-4 in Bootstrap.
  • Grid: 1 column, then 2 from md, then 3 from lg, is grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 in Tailwind, and col-12 col-md-6 col-lg-4 on each box inside a row g-3 in Bootstrap 5, because 12 ÷ 2 = 6 and 12 ÷ 3 = 4.
  • SCSS: .card { color: red; &:hover { color: blue; } .title { margin: 0; } } gives three rules: .card, .card:hover and .card .title.

Limits you should know

  • The rules are those of Tailwind CSS 3.4 and Bootstrap 5.3 with their default settings. A project that changed its theme, its spacing scale or its breakpoints gets other values from the framework than from this page.
  • In Tailwind CSS 3 not every number is a step of the spacing scale. A number that is not, such as p-13, is still worked out by the rule, with a note.
  • A breakpoint keeps its name between the two frameworks, but not its width: md is 768 pixels in both, lg is 1024 pixels in Tailwind and 992 pixels in Bootstrap.
  • Bootstrap marks every utility class as !important. The page leaves that mark out of the CSS it writes.
  • When two classes of one list set the same property, only the first is converted and the second is listed: which one wins in the framework depends on its style sheet, not on the order you type.
  • The page reads a class list or a style sheet as text. It does not read your HTML, does not load a framework, and does not sort or remove classes.

Related tools