tailwindconvert
GitHub

Tailwind CSS Converter

Convert between plain CSS and Tailwind CSS utility classes instantly. Bidirectional, free, and runs entirely in your browser.

No data sent to any server — 100% client-side conversion

CSS Input
Tailwind Classes Output
Tailwind classes will appear here...

よくある質問

Q. CSSからTailwindに変換できないスタイルはありますか?

A. Tailwindのデフォルトスケールに存在しない値(例: padding: 7px)は、任意の値としてp-[7px]のような形式に変換されます。一部のCSS関数や複雑なセレクターは変換されない場合があります。

Q. Tailwind CSS v3とv4の違いはありますか?

A. v4ではCSS変数ベースの設計に移行し、tailwind.config.jsが不要になりました。クラス名の変更もあります。本ツールはv3の記法を基準にしています。

Q. 変換結果をそのまま本番コードに使えますか?

A. 目安として使用し、実際のコードではデザインシステムとの整合性を確認してください。特にカスタム値を含む場合はTailwindの設定ファイルへの追加が必要な場合があります。

Ad Space

Common CSS to Tailwind Patterns

Quick reference table for the most frequently used CSS properties and their Tailwind CSS equivalents.

CategoryCSSTailwind
Layoutdisplay: flexflex
Layoutdisplay: gridgrid
Layoutdisplay: nonehidden
Layoutdisplay: blockblock
Layoutposition: relativerelative
Layoutposition: absoluteabsolute
Layoutposition: fixedfixed
Layoutposition: stickysticky
Flexboxflex-direction: columnflex-col
Flexboxjustify-content: centerjustify-center
Flexboxjustify-content: space-betweenjustify-between
Flexboxalign-items: centeritems-center
Flexboxflex-wrap: wrapflex-wrap
Flexboxflex: 1 1 0%flex-1
Flexboxgap: 1remgap-4
Spacingpadding: 1remp-4
Spacingpadding: 0.5rem 1rempx-4 py-2
Spacingmargin: 0 automx-auto
Spacingmargin-top: 1remmt-4
Spacingmargin-bottom: 2remmb-8
Sizingwidth: 100%w-full
Sizingheight: 100%h-full
Sizingmax-width: 80remmax-w-7xl
Sizingmin-height: 100vhmin-h-screen
Typographyfont-size: 0.875remtext-sm
Typographyfont-size: 1.25remtext-xl
Typographyfont-size: 1.5remtext-2xl
Typographyfont-weight: 700font-bold
Typographyfont-weight: 600font-semibold
Typographytext-align: centertext-center
Typographytext-transform: uppercaseuppercase
Typographyline-height: 1.5leading-normal
Bordersborder-radius: 0.5remrounded-lg
Bordersborder-radius: 9999pxrounded-full
Bordersborder-width: 1pxborder
Bordersborder-style: solidborder-solid
Effectsbox-shadow: 0 1px 3px ...shadow
Effectsbox-shadow: 0 10px 15px ...shadow-lg
Effectsopacity: 0.5opacity-50
Interactivitycursor: pointercursor-pointer
Interactivityoverflow: hiddenoverflow-hidden
Interactivityuser-select: noneselect-none
Transitionstransition-property: alltransition-all
Transitionstransition-duration: 300msduration-300

Why Use a Tailwind CSS Converter?

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs without writing traditional CSS. Instead of writing display: flex; justify-content: center;, you simply add flex justify-center as CSS classes directly in your HTML. This approach speeds up development, reduces CSS file size through purging unused styles, and makes it easy to maintain consistent designs across large projects.

Why Convert CSS to Tailwind?

Converting existing CSS to Tailwind utility classes is one of the most common tasks when migrating a project to Tailwind CSS. If you have an existing codebase with traditional stylesheets, a CSS to Tailwind converter helps you quickly translate your styles into utility classes. This is especially useful when refactoring legacy code, onboarding new team members who are learning Tailwind, or when you find a CSS snippet online and want to use it in your Tailwind project.

Why Convert Tailwind to CSS?

The reverse direction is equally valuable. Sometimes you need to understand what CSS a Tailwind class actually generates, or you need to extract styles from a Tailwind project into plain CSS for use in a non-Tailwind environment. A Tailwind to CSS converter lets you quickly see the underlying CSS properties for any combination of utility classes. This is helpful for debugging, learning, and for projects that need to support both Tailwind and traditional CSS workflows.

How This Tool Works

This Tailwind CSS converter runs entirely in your browser. It uses a comprehensive mapping dictionary covering the most common CSS properties and their Tailwind equivalents, including layout, spacing, typography, colors, borders, shadows, flexbox, grid, and more. Simply paste your CSS or Tailwind classes in the input panel, and the converted output appears instantly. The converter handles selectors, nested rules, and shorthand properties. For any CSS property that does not have a direct Tailwind equivalent, it shows a helpful comment so you know which properties need manual conversion.

Supported Properties

The converter supports over 60 of the most commonly used CSS properties, including display, position, padding, margin, width, height, font-size, font-weight, color, background-color, border-radius, box-shadow, flexbox properties like justify-content and align-items, grid properties like grid-template-columns and col-span, overflow, opacity, cursor, z-index, transitions, and many more. The spacing system accurately maps pixel and rem values to Tailwind's spacing scale.

Tips for Using the Converter

  • You can paste full CSS rules with selectors, or just bare property declarations without selectors.
  • Use the mode toggle button to switch between CSS-to-Tailwind and Tailwind-to-CSS directions.
  • Click the Copy button to quickly copy the output to your clipboard.
  • Check the reference table below the converter for common patterns you can memorize over time.
  • For responsive designs, remember that Tailwind uses prefix modifiers like sm: , md: , and lg: instead of media queries.