Skip to main content

InstrumentsSpecificity Calculator

Specificity Calculator

Count the ID, class and element weight of a CSS selector or selector list, with a per-selector breakdown.

All tools

Specificity Calculator

Separate selectors with commas. Up to 500 characters. Counts a selector by the specificity rules, as a summary, not a full CSS parser.

IDs
0
Classes
1
Elements
4
Specificity (ids,classes,elements)
0,1,4
Result summary
Specificity: 0,1,4 (ids 0, classes 1, elements 4)
Selector: nav ul li a.active

Note: This is a counting rule summary, not a full CSS parser. :is() and :has() use the highest-specificity argument, as the CSS spec defines. :where() counts as zero.

This is a counting rule summary, not a full CSS parser. :is() and :has() use the highest-specificity argument, as the CSS spec defines. :where() counts as zero.

FAQ

What do the three numbers mean?

Specificity is written as three numbers: ID selectors, then classes (including attribute selectors and pseudo-classes), then elements (type names and pseudo-elements). The numbers are compared from left to right, so one ID outweighs any number of classes.

How are :is(), :not() and :has() counted?

Each one counts as its most specific argument, which is how the CSS spec defines them. :where() counts as zero, so it is useful for rules that should be easy to override.

Is this a full CSS parser?

No. It is a counting rule summary for common selectors. It does not check whether a selector matches anything on a page, does not support escape sequences or namespace prefixes, and does not follow the cascade across stylesheets.

  1. 01CSS Architecture: Scalable Object-Oriented CSSTutorial
  2. 02CSS Integration Strategy: Scoping & LoadingTutorial

Personalize your path

Choose your experience level once.

Next Step

Build fundamentals after each tool run so you can apply concepts with confidence.

Get new tool alerts

Receive updates when new tools are published.

RSS feed