CSS Specificity Calculator
Score CSS selectors by ID, class, and element count
How the score works
- IDs count in the first column, so one ID outweighs any number of classes.
- Classes include attribute selectors and pseudo-classes such as :hover.
- Elements include tag names and pseudo-elements such as ::before.
- :where() adds nothing, while inline styles beat every selector.
About the CSS Specificity Calculator
The CSS Specificity Calculator scores selectors so you can see which rule wins. Paste the selectors that conflict and compare their ID, class, and element counts side by side.
Specificity conflicts usually appear after a refactor or a theme override. Score both selectors, then prefer lowering the stronger one over adding !important to the weaker.
- ✓Scores in (a, b, c) notation
- ✓Ranks the strongest selector
- ✓Handles :where and functional pseudo-classes
How to use the CSS Specificity Calculator
- 1
Paste one selector per line.
- 2
Compare the three-column scores.
- 3
Adjust the losing selector or reorder your rules.
Frequently asked questions
What wins between two selectors with equal specificity?+
The one that appears later in the stylesheet, or the one in a later-loaded stylesheet. Source order breaks the tie, not selector length.
Do inline styles affect the calculation?+
Inline styles sit above every selector, so the only way to override them is !important. The calculator covers stylesheet selectors only.
Save CSS Specificity Calculator to your favorites, or keep browsing developer tools.
Browse all 35 developer tools →