Tailwind Class Sorter
Sort Tailwind classes and detect conflicting utilities with a winner explanation.
OpenCompare selector weights in seconds and stop guessing why a style is overridden.
Enter one selector per line, or start from the sample.
See ids, classes and elements counted for every line.
The higher first differing number decides the winner.
Copy or download the list for a code review note.
Your new .button-primary color loses to an old rule somewhere in the theme, and DevTools shows it crossed out. You have three candidate selectors and want to know which one is heavier. Paste them in and compare the scores.
Enter one selector per line. For each, the calculator counts ids, then classes, attribute selectors and pseudo-classes, then element names, and prints the tuple next to the selector along with a single combined number. The combined number is a convenience only: compare tuples from left to right, where any id outweighs any number of classes, and any class outweighs any number of elements.
The counting is a quick pattern match rather than a full selector parser, so a few cases need care. Pseudo-elements such as ::before are counted in the class column, although the specification puts them with elements. :not() is counted as a pseudo-class plus whatever is inside it, while the specification counts only its argument, and :where() should count as zero. When two selectors are equal, the one that appears later in the stylesheet wins, which this tool cannot see. If the conflict is between Tailwind utilities, the Tailwind class conflict checker explains it better, and the design system diff lab also lists @layer names, which outrank specificity altogether.
Scores update as you type.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
Specificity is not a base-10 number. Each column is compared separately, and the id column is checked first. The combined figure in the output is only a quick reference.
No. Inline styles beat any selector, and !important declarations sit above normal ones regardless of specificity. The calculator only scores selector text.
Treat them with care. This calculator counts ::before as a class-level item and counts :not itself as a pseudo-class, so both read slightly higher than the specification would give.