CSS Specificity Calculator
Calculate CSS selector specificity (IDs, classes, elements) for one selector or a whole stylesheet, including :is(), :not(), :has() and :where(). Ranked list.
Calculator
About this tool
About CSS Specificity Calculator
Why does one CSS rule win over another? Paste selectors – or a whole CSS file – and the calculator gives each one its specificity as (IDs, classes/attributes/pseudo-classes, elements/pseudo-elements), ranks them from strongest to weakest and explains how they compare. It follows Selectors Level 4: :is(), :not() and :has() take their strongest argument, :where() counts zero, :nth-child(… of S) adds S, and legacy pseudo-elements like :before count as elements.
How it works
Example
How to use this tool
- Type selectors (one per line) or paste a stylesheet.
- Read the specificity of each selector.
- Use the ranking to fix rules that do not apply.
Frequently asked questions
Does order in the file matter?
Only when specificity is equal – then the rule that comes later wins.
How do I lower specificity?
Use classes instead of IDs, avoid long chains, and wrap selectors in :where() to make them zero.
Is my data uploaded?
No. Everything runs in your browser and stays on this device.
Is my design uploaded by the CSS Specificity Calculator?
No. The CSS Specificity Calculator works in your browser, so your images and colours stay on your device.