Compound class with descendant
Input: .sidebar .nav-item.active
Output: Specificity: (0, 3, 0) — three classes/pseudo-classes, no IDs, no elements.
500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.
Calculate and compare the specificity score of any CSS selector to understand cascade order and override priority.
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().
Input: .sidebar .nav-item.active
Output: Specificity: (0, 3, 0) — three classes/pseudo-classes, no IDs, no elements.
Input: #header .logo:hover vs .header .logo:hover
Output: (1, 2, 0) vs (0, 3, 0) — the ID-prefixed version wins regardless of source order.
Input: :where(#main, .container) p
Output: Specificity: (0, 0, 1) — :where() contributes 0; only the p element counts.
Input: :is(#a, .b, span) p
Output: Specificity: (1, 0, 1) — :is() picks up #a's ID weight, plus the trailing p element.