Skip to content
Tesserae

Keyboard shortcuts

Focus search
/
This help dialog
?
Run the current tool
Ctrl/⌘ +Enter
Copy the output (when an output is focused)
Ctrl/⌘ +C

Shortcuts are ignored while you are typing in an input, a textarea or a select.

Developer Utilities

CSS Specificity Calculator

Paste one or more CSS selectors to get their specificity as an (a,b,c) triple and a comparison rank. The calculator follows the CSS Selectors Level 4 rules: ID selectors count for a, classes, attributes and pseudo-classes for b, and type selectors and pseudo-elements for c, with :not()/:is()/:has() taking the specificity of their most specific argument and :where() counting as zero. Inline styles and !important are reported separately.

On-device No network Offline-ready

🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.

Try:

Options

Your result will appear here

Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.

How it works

What the (a,b,c) score means

Specificity is how the cascade breaks a tie between two rules that both match the same element: the more specific selector wins. This tool scores each selector you paste as an (a,b,c) triple, where a counts ID selectors, b counts classes, attribute selectors and pseudo-classes, and c counts type selectors and pseudo-elements. Scores are compared lexicographically — a single ID (0,1,0) always beats any number of classes — and the tool reports which of your selectors wins.

When to check a selector

Reach for it when a style you wrote is not applying and you cannot see why, when you are about to add !important and want to know whether a more specific selector would do, or when reviewing a stylesheet whose rules were added over time and now fight each other. Paste the competing selectors one per line and the ranking shows the true winner.

The Level 4 subtleties

The scorer follows Selectors Level 4. :not(), :is() and :has() contribute the specificity of their most specific argument rather than a fixed weight, so :is(#a, .b) counts as an ID. :where() always contributes zero, which makes it the right wrapper for low-priority defaults. Functional pseudo-elements and legacy single-colon pseudo-elements such as :before are counted in c.

What is not part of the triple

Inline style attributes outrank any selector specificity, and !important declarations outrank normal ones regardless of the score — neither is folded into (a,b,c), and the tool flags them separately so you are not misled into thinking a bigger number will win. The explain option can be turned off if you only want the scores and the ranking.

Your stylesheet stays here

Selectors are parsed and scored in this tab. Nothing is uploaded and no request is made, so you can paste selectors from a client stylesheet or an unreleased design system without exposing them.

Questions

How is the score calculated?

The (a,b,c) triple: a = ID selectors, b = classes, attributes and pseudo-classes, c = type selectors and pseudo-elements. Compare lexicographically — 0,1,0 beats 0,0,9.

How do :not(), :is() and :where() count?

Per Selectors Level 4, :not() and :is() contribute the specificity of their most specific argument (the pseudo-class itself adds nothing), while :where() always contributes zero.

Where do !important and inline styles fit?

They are not part of the (a,b,c) triple. Inline styles outrank any selector specificity, and !important declarations outrank normal ones regardless of specificity — both are noted separately in the output.

See category