CSS Specificity Calculator

Type or paste CSS selectors, one per line, and see their specificity and which wins.

How this is worked out

Specificity is written as three numbers: how many ID selectors, how many classes, attributes and pseudo-classes, and how many element names and pseudo-elements. They are compared from left to right, so one ID outweighs any number of classes. :where() counts as zero; :is(), :not() and :has() count as their most specific argument. The universal selector and combinators add nothing.

Frequently asked questions

Why does my CSS rule not apply?

Often a rule with higher specificity elsewhere wins. Compare the two selectors here, then raise the specificity of yours or lower the other one. Avoid !important unless you have to.

Related tools: Css Minifier, Css Flexbox Generator, Px To Rem Converter.

Something not working on this page? Tell me through the Contact page: that is how I find out what is broken and fix it.