CSS Specificity Calculator

Instantly calculate the specificity (A,B,C) of any CSS selector. Compare two selectors and find out which rule wins.

Quick Examples

Results update live as you type

Specificity Reference

Selector / RuleScore
!importantOverrides all
Inline style1,0,0,0
#id0,1,0,0
.class / [attr] / :hover0,0,1,0
div / ::before0,0,0,1
* (universal)0,0,0,0

About the CSS Specificity Calculator

CSS specificity is a weight applied to a given CSS declaration, determined by the number of each selector type in the matching selector. When multiple declarations have equal specificity, the last declaration found in the CSS is applied to the element.

The specificity is represented as a three-number score: (A, B, C). A = ID selectors, B = class selectors, attribute selectors, and pseudo-classes, C = type selectors and pseudo-elements. A higher A value always beats any B or C value, no matter how large they are.

Use the Single Selector mode to instantly see the score for any selector as you type. Switch to Compare Two mode to paste in two competing selectors and find out which one wins in the cascade.

All calculations happen entirely in your browser — no data is sent to any server.

FAQ

Is CSS Specificity Calculator free to use?

Yes, CSS Specificity Calculator is completely free to use on UtilityCove.

Does CSS Specificity Calculator upload my data?

No. CSS Specificity Calculator runs in your browser, so your input stays on your device.

Can I use CSS Specificity Calculator on mobile?

Yes. CSS Specificity Calculator works on modern mobile and desktop browsers.