Compound class with descendant
.sidebar .nav-item.activeSpecificity: (0, 3, 0) — three classes/pseudo-classes, no IDs, no elements.Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
Calculate and compare the specificity score of any CSS selector to understand cascade order and override priority.
Loading interactive tool…
The CSS Specificity Calculator parses any CSS selector and computes its specificity score as a three-number tuple (a, b, c) representing inline styles, IDs, and classes/attributes/pseudo-classes respectively, plus the total specificity for comparison. Specificity determines which rule wins when multiple selectors target the same element — higher specificity overrides lower, regardless of source order, unless !important is used. The tool accepts multiple selectors for side-by-side comparison and ranks them so you can immediately see which selector wins. It handles compound selectors, pseudo-classes, pseudo-elements, attribute selectors, :not(), :is(), :where(), and :has().
Instantly calculates specificity for any valid CSS selector — no manual counting needed.
Side-by-side comparison shows which selector wins the cascade and by how much.
Explains each component (IDs, classes, elements) with a breakdown.
Handles modern pseudo-classes including :is(), :where(), and :has().
.sidebar .nav-item.activeSpecificity: (0, 3, 0) — three classes/pseudo-classes, no IDs, no elements.#header .logo:hover vs .header .logo:hover(1, 2, 0) vs (0, 3, 0) — the ID-prefixed version wins regardless of source order.:where(#main, .container) pSpecificity: (0, 0, 1) — :where() contributes 0; only the p element counts.:is(#a, .b, span) pSpecificity: (1, 0, 1) — :is() picks up #a's ID weight, plus the trailing p element.