Sort and organize Tailwind CSS classes automatically. Remove duplicates, alphabetize
classes, match official recommended order. Free Tailwind tool.
Why Sort Tailwind Classes?
Tailwind CSS recommends sorting utility classes in a specific order to improve
code readability and maintainability. The official order groups related utilities:
layout first, then spacing, typography, and so on. This makes it easier to find
and modify specific styles in long class strings.
Recommended Class Order
Layout (display, position, z-index)
Flexbox & Grid
Spacing (margin, padding)
Sizing (width, height)
Typography (font-size, text-align)
Background & Borders
Effects (shadow, opacity)
Transitions & Animation
Benefits
Easier to read and understand at a glance
Faster to find and modify specific styles
Consistent code style across your team
Reduces duplicate classes automatically
Frequently Asked Questions
Why should I sort Tailwind classes?
Sorting Tailwind classes makes your code more consistent and
maintainable. The official recommended order groups related utilities together (layout,
spacing, typography, etc.), making it easier to scan and modify your classes.
Does this remove duplicate classes?
Yes! The sorter automatically removes duplicate classes. For
example, if you have 'p-4 p-4' it will be reduced to just 'p-4'. This helps keep your
HTML clean and reduces file size.
Is this compatible with Tailwind CSS v3?
Yes, this tool is compatible with Tailwind CSS v3 and earlier
versions. It follows the official Tailwind Labs recommended class order which applies to
all recent versions.
Should I use a Prettier plugin instead?
Prettier with prettier-plugin-tailwindcss is great for automated
formatting in your editor. This tool is useful for quick one-off sorting, checking
existing code, or when you don't have Prettier set up.