CSS Specificity Calculator (Debug Style Overrides)

Why isn't my rule applying? Paste your selectors — one per line — and see their (a,b,c) weights ranked, with a breakdown of what counted.

—
Embed this tool on your website / blog No code required · Copy and paste
HTML Embed Code (iframe):
<iframe src="https://lucentool.com/css-specificity-calculator" width="100%" height="650" style="border:1px solid #e5e0d8;border-radius:12px;max-width:850px;width:100%;" frameborder="0"></iframe>
<div style="font-size:12px;color:#78716c;margin-top:6px;font-family:sans-serif;">Powered by <a href="https://lucentool.com/css-specificity-calculator" target="_blank" style="color:#c85a32;text-decoration:none;">Lucentool - CSS Specificity Calculator & Weight Scorer</a></div>

How specificity works

When two rules target the same element, the browser picks the more specific one. Specificity is counted as three numbers (a, b, c):

Compare left to right: (1,0,0) beats (0,5,0); (0,2,0) beats (0,1,3). The universal selector *, combinators (> + ~) and :where() add nothing.

Modern selectors

Practical takeaway

If a style "isn't applying", the almost-always cause is specificity — your other rule has a higher (a,b,c). The calculator shows you the numbers so you can decide: raise yours (add a class or ID), or lower theirs (use :where() to zero out a wrapper selector).

Edge cases and hard limits

selectorList() splits a comma-separated selector into individual selectors, and specificity() scores each one as a triple: id count, class/attribute/pseudo-class count, element/pseudo-element count. cmp() compares those triples lexicographically, balanced() handles nested parentheses, and ident() finds identifier boundaries so a class name inside an attribute string is not miscounted. Pseudo-classes that take a selector argument use the highest specificity inside them.

Formats, sizes and other limits

Specificity is one input to the cascade, not the whole story. !important, source order, inheritance, cascade layers, inline styles and shadow boundaries all override or bypass it, and none are modelled here. A selector list produces several scores but the page cannot tell you which one wins, because that needs the DOM and the declaration order.

Privacy: processed in your browser

Selectors are scored as text in this tab. The page cannot read your stylesheets, and nothing you paste is sent.

Frequently asked questions

Why is my rule not applying?

Specificity may not be the reason. Check for !important, load order, @layer precedence, or a selector that simply does not match.

Do selectors inside :not() count?

Yes. They are scored normally and the highest inside the parentheses is added to the outer selector.

How do inline styles compare?

Inline styles beat any selector except one marked !important. This tool scores selectors only.