Free online tools

CSS Specificity Calculator

Paste a selector list or put each selector on its own line. See the specificity triple for each one.

Enter your values

This tool processes your input in your browser.

Result

Compare ID, class and type counts in order

IDs contribute to the first column. Classes, attributes and ordinary pseudo-classes contribute to the second. Type selectors and pseudo-elements contribute to the third. The leftmost differing count wins a specificity comparison.

Apply the exceptions for functional pseudo-classes

The most specific argument of :is(), :not() or :has() contributes to the result. :where() contributes zero. :nth-child() and :nth-last-child() include the most specific selector after an of clause.

Check the full cascade when debugging a style

The result is selector weight. Cascade origin, layers, importance, scope and order can also affect which declaration applies. This parser is scoped to selector syntax; it does not read full style rules.

Frequently asked questions

Can I use the nesting selector &?

The weight of & depends on the parent rule. Expand the parent selector first and enter the full selector.