CSS Specificity Calculator

All tools

CSS selectors

Summary

Selectors
0
Strongest
0-0-0
Status
Idle
Specificity is shown as A-B-C: IDs, classes/attributes/pseudo-classes, and elements/pseudo-elements.

Specificity results

Analyze selectors to see specificity scores.

About CSS Specificity Calculator

CSS specificity decides which selector wins when multiple rules target the same element. This calculator shows the A-B-C score for each selector.

It counts IDs, classes, attributes, pseudo-classes, elements, and pseudo-elements, including common selector functions such as :is(), :not(), :has(), and :where().

How to use this tool

  1. Paste one selector per line, a comma-separated selector list, or full CSS rules.
  2. Click Analyze to calculate specificity for each selector.
  3. Compare the A-B-C scores and review which selector is strongest.

Tips

  • Avoid unnecessary IDs when you want CSS that is easy to override.
  • :where() always has zero specificity, which is useful for low-priority defaults.
  • When selectors have equal specificity, the later matching CSS rule usually wins.

CSS specificity checks before changing an override

A selector score explains one part of the cascade. Layer order, origin, importance, scope, and source order can still decide the winning declaration.

Compare the full cascade

Check origin, cascade layers, !important, specificity, scoping proximity, and source order before increasing selector weight.

Keep selectors maintainable

Prefer classes and deliberate component boundaries over IDs, deep nesting, repeated selectors, or escalating !important rules.

Inspect functional selectors

Remember that :is(), :not(), and :has() use argument specificity, while :where() always contributes zero specificity.

Test the rendered state

Verify hover, focus, disabled, responsive, theme, and dynamically inserted states in browser developer tools.

Related tools

You may also find these tools useful.

CSS specificity FAQ

What does A-B-C mean?
A is ID selectors, B is classes, attributes, and pseudo-classes, and C is element and pseudo-element selectors.
Does inline style count here?
This tool calculates selector specificity. Inline styles are outside selector specificity and are normally stronger than stylesheet selectors.
How does :where() affect specificity?
:where() contributes zero specificity, even when its arguments contain IDs or classes.
Can I paste full CSS rules?
Yes. The tool extracts selectors before opening braces and analyzes them.