CSS Specificity Calculator.
Calculate and compare CSS selector specificity, including :is(), :not(), :has(), :where() and nth-child(of S).
Runs in your browserAbout CSS Specificity Calculator
The CSS Specificity Calculator explains why one rule beats another. Paste one or more selectors and each gets its specificity as three numbers (a,b,c): IDs, then classes, attributes and pseudo-classes, then type selectors and pseudo-elements. Selectors are compared column by column, so a single ID (1,0,0) outranks any number of classes (0,15,0). The table ranks every selector and the summary tells you which one wins when they all match the same element, including the rule that the last one in source order wins a tie. The calculator follows Selectors Level 4: :is(), :not() and :has() take the specificity of their most specific argument, :where() always counts as zero, :nth-child(2n of .item) adds one pseudo-class plus its selector list, and the universal selector and combinators add nothing. For example, #nav .item > a:hover is (1,2,1) while ul li a is only (0,0,3). Legacy single-colon pseudo-elements such as :before are recognised and flagged. Common surprises are :not(#id) adding a full ID, :is(#a, .b) counting as an ID even when .b matched, and long chains of classes still losing to a single ID. Syntax errors are reported with line and column. Inline styles and !important sit above specificity and are not part of the calculation. Everything runs in your browser.
How to Use
- Paste selectors, one per line or as a comma-separated list.
- Read the (a,b,c) score and rank of each selector.
- Check the summary to see which selector wins when all of them match.
Frequently Asked Questions
How is specificity compared?
Column by column from left to right. The selector with more IDs wins; if equal, more classes/attributes/pseudo-classes; if still equal, more types/pseudo-elements; if all equal, the later rule wins.
What is the specificity of :is() and :where()?
:is(), :not() and :has() take the specificity of their most specific argument. :where() is always zero, which makes it useful for low-priority defaults.
Where do inline styles and !important fit?
Above specificity. Inline style attributes beat any selector, and !important declarations beat normal ones; cascade layers also come before specificity.
Is my CSS uploaded?
No. Parsing happens in your browser.
Related Tools
Check text and UI color contrast against WCAG 2.2 AA and AAA, with the closest passing colors.
Experiment with flexbox and CSS grid container properties on live boxes and copy the CSS or Tailwind classes.
Build linear, radial and conic CSS gradients with a live preview, OKLCH interpolation and Tailwind output.
Test regular expressions with match highlighting.
Encode and decode HTML entities.
Set each corner radius, including elliptical corners, and copy the shortest CSS or Tailwind classes.