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
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の設定ファイルへの追加が必要な場合があります。
Common CSS to Tailwind Patterns
Quick reference table for the most frequently used CSS properties and their Tailwind CSS equivalents.
| Category | CSS | Tailwind |
|---|---|---|
| Layout | display: flex | flex |
| Layout | display: grid | grid |
| Layout | display: none | hidden |
| Layout | display: block | block |
| Layout | position: relative | relative |
| Layout | position: absolute | absolute |
| Layout | position: fixed | fixed |
| Layout | position: sticky | sticky |
| Flexbox | flex-direction: column | flex-col |
| Flexbox | justify-content: center | justify-center |
| Flexbox | justify-content: space-between | justify-between |
| Flexbox | align-items: center | items-center |
| Flexbox | flex-wrap: wrap | flex-wrap |
| Flexbox | flex: 1 1 0% | flex-1 |
| Flexbox | gap: 1rem | gap-4 |
| Spacing | padding: 1rem | p-4 |
| Spacing | padding: 0.5rem 1rem | px-4 py-2 |
| Spacing | margin: 0 auto | mx-auto |
| Spacing | margin-top: 1rem | mt-4 |
| Spacing | margin-bottom: 2rem | mb-8 |
| Sizing | width: 100% | w-full |
| Sizing | height: 100% | h-full |
| Sizing | max-width: 80rem | max-w-7xl |
| Sizing | min-height: 100vh | min-h-screen |
| Typography | font-size: 0.875rem | text-sm |
| Typography | font-size: 1.25rem | text-xl |
| Typography | font-size: 1.5rem | text-2xl |
| Typography | font-weight: 700 | font-bold |
| Typography | font-weight: 600 | font-semibold |
| Typography | text-align: center | text-center |
| Typography | text-transform: uppercase | uppercase |
| Typography | line-height: 1.5 | leading-normal |
| Borders | border-radius: 0.5rem | rounded-lg |
| Borders | border-radius: 9999px | rounded-full |
| Borders | border-width: 1px | border |
| Borders | border-style: solid | border-solid |
| Effects | box-shadow: 0 1px 3px ... | shadow |
| Effects | box-shadow: 0 10px 15px ... | shadow-lg |
| Effects | opacity: 0.5 | opacity-50 |
| Interactivity | cursor: pointer | cursor-pointer |
| Interactivity | overflow: hidden | overflow-hidden |
| Interactivity | user-select: none | select-none |
| Transitions | transition-property: all | transition-all |
| Transitions | transition-duration: 300ms | duration-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:, andlg:instead of media queries.