How to use the CSS Specificity Calculator
- Paste selectors, one per line.
- Read each score as IDs, classes, elements.
- The list is ranked — the top selector wins.
What does this tool do?
When two rules target the same element, the one with higher specificity wins, compared column by column. This calculator follows Selectors Level 4: :where() counts zero, :is(), :not() and :has() take their most specific argument, and pseudo-elements count as elements. Inline styles and !important override specificity entirely.
Everything runs in your browser — nothing you paste is uploaded.
Why use it?
- Selectors Level 4 rules.
- Ranked results.
- Handles selector lists.
Use cases
- Debug why a CSS rule isn't applying.
- Keep a stylesheet's specificity low and predictable.
- Learn how :is(), :where() and :not() are scored.
Scores, highest first
Specificity is compared column by column, IDs first:
| Selector | IDs, classes, elements |
|---|---|
| #nav .item a | 1, 1, 1 |
| .btn.primary | 0, 2, 0 |
| ul li:hover | 0, 1, 2 |
| a::before | 0, 0, 2 |
| :where(.card) p | 0, 0, 1 |
Common mistakes
- Fixing conflicts with !important instead of simpler selectors.
- Using IDs for styling, which are hard to override later.
- Thinking that more classes always beat one ID — a single ID wins.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
What if two selectors have the same score?
The one that appears later in the CSS wins.
Why does :where() count zero?
It was designed for easily overridable defaults, so it adds no specificity.
Do inline styles have specificity?
They beat any selector, and only !important rules can override them.
Content last updated . See how M2Toolkit works.