Compound class with descendant
.sidebar .nav-item.activeIDs 0, Classes 3, Elements 0 — Total 30Calculate the specificity of a CSS selector and compare it with a second selector to see which wins the cascade.
Loading interactive tool…
The CSS Specificity Calculator counts the parts of a CSS selector and shows its specificity as three numbers: IDs, Classes (classes, attributes and pseudo-classes) and Elements, plus a Total computed as IDs×100 + Classes×10 + Elements. Specificity determines which rule wins when multiple selectors target the same element — higher specificity overrides lower, regardless of source order, unless !important is used. Type a selector in the first field and, optionally, a second selector to compare; the tool says which one wins or that they tie and source order decides. It counts plain IDs, classes, attributes, pseudo-classes, :not() arguments and element names as you type. It does not apply the special rules for :is(), :where() and :has(), counts ::before and other pseudo-elements as classes, and compares by the Total, so a selector with ten or more classes is wrongly ranked above one with an ID. Check those cases by hand.
Calculates specificity for everyday selectors as you type — no manual counting needed.
Compares two selectors and states which one wins the cascade.
Shows the IDs, Classes and Elements counts separately so you can see what drives the score.
Runs entirely in your browser; selectors never leave the page.
.sidebar .nav-item.activeIDs 0, Classes 3, Elements 0 — Total 30#header .logo:hover vs .header .logo:hover1, 2, 0 (Total 120) vs 0, 3, 0 (Total 30) — First selector wins (120 vs 30)input[type="text"]IDs 0, Classes 1, Elements 1 — Total 11a:not(.x)IDs 0, Classes 1, Elements 1 — Total 11Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.