CSS Specificity Calculator for Selectors
Compare selector weight when debugging the cascade, refactoring CSS, or reviewing design system overrides.
CSS specificity compares selector weights in ID, class-like, and element-like groups.
Higher scores usually win when competing rules apply to the same element.
Paste complete selectors
Include IDs, classes, attributes, pseudo-classes, and elements exactly as used in CSS.
Compare close matches
The tool is most useful when two selectors target the same component state.
Try a common specificity check
Selectors
5
Strongest
1-1-1
Format
A-B-C
| Score | IDs | Classes | Elements | Selector |
|---|---|---|---|---|
| 1-1-1 | 1 | 1 | 1 | #app .card > h2 |
| 0-3-0 | 0 | 3 | 0 | .button.primary:hover |
| 0-2-3 | 0 | 2 | 3 | main article.post[data-state="published"] h1 |
| 0-1-2 | 0 | 1 | 2 | :where(.shell) nav a[aria-current="page"] |
| 0-1-1 | 0 | 1 | 1 | :is(header, main, footer) .link |
#app .button:hover with .card .button.primary to see which selector carries more cascade weight.Suggested workflow
CSS debugging workflow
Clean CSS, compare selector weight, then tune responsive values and colors.
What is CSS specificity?
CSS specificity is the weight browsers use to decide which selector wins when multiple rules target the same element.
What does 1-2-3 mean?
The score means 1 ID selector, 2 class-like selectors, and 3 element-like selectors.
Does this tool need a backend workflow?
No backend workflow is required for the public calculator interface; selector parsing and scoring are handled in the browser for this tool.
Does :where() add specificity?
No. This calculator treats :where() as zero specificity, matching modern CSS behavior.