Automatically organize and reorder Tailwind utility classes by category — layout, spacing, typography, colors, and more.
The sorter parses each class token using regex-based prefix matching and assigns it to one of Tailwind's official ordering categories — layout, flexbox/grid, spacing, sizing, typography, backgrounds, borders, effects, transitions, transforms, interactivity, and accessibility. Each class receives a numeric weight based on its category rank, then classes are stable-sorted by weight. Optional deduplication uses a Set to keep only the first occurrence. Category tags are generated from the matched prefix so you can visually scan the structure of your utility stack.
md:p-6 sorts correctly as padding, and hover:bg-blue-600 sorts as a background. The variant prefix is preserved in the output.