CSS Specificity Calculator — Why Your Rule Lost
Work out a selector's specificity and see which parts contributed what.
Specificity is three numbers compared left to right: IDs, then classes and attributes and pseudo-classes, then elements and pseudo-elements. Any number of classes loses to a single ID, because the comparison never carries — 0,99,0 is beaten by 1,0,0. Two things trip people up most: :where() contributes nothing at all, which makes it the tool for writing overridable defaults, while :is(), :not() and :has() take the specificity of their most specific argument. When two rules tie, the one written later wins.
Runs in your browser- Privacy
- Runs entirely in your browser — nothing is uploaded
- Cost
- Free, unlimited, no sign-up
Frequently asked questions
Why does my class not override an ID?
What does :where() do to specificity?
What beats !important?
How to use the css specificity calculator
- 1Enter or paste your selector.
- 2The result appears immediately — copy or download it.
Embed this tool
Put the working css specificity calculator on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.
Share this tool
Related tools
Last updated
More css generators