AscendLab

Developer tools · Browser-side · No account

CSS Specificity Calculator

Developer toolsPublic tools run in your browser unless a page says otherwise.No account is required for this tool.
New free tool

CSS Specificity Calculator for Selectors

Compare selector weight when debugging the cascade, refactoring CSS, or reviewing design system overrides.

Quick answer

CSS specificity compares selector weights in ID, class-like, and element-like groups.

Higher scores usually win when competing rules apply to the same element.

Best inputs

Paste complete selectors

Include IDs, classes, attributes, pseudo-classes, and elements exactly as used in CSS.

Compare close matches

The tool is most useful when two selectors target the same component state.

CSS selectors
Paste one selector per line, or comma-separated selector lists.

Try a common specificity check

Specificity results
Scores use the common ID, class, element format.

Selectors

5

Strongest

1-1-1

Format

A-B-C

ScoreIDsClassesElementsSelector
1-1-1111#app .card > h2
0-3-0030.button.primary:hover
0-2-3023main article.post[data-state="published"] h1
0-1-2012:where(.shell) nav a[aria-current="page"]
0-1-1011:is(header, main, footer) .link
Specificity scores are calculated for common selectors. Cascade layers, source order, inheritance, and browser support can still change the final applied style.
Example
Compare #app .button:hover with .card .button.primary to see which selector carries more cascade weight.
Assumption
Scores use the common A-B-C model: IDs, class-like selectors, and element-like selectors.
Limitation
Specificity is only one cascade factor. Source order, cascade layers, importance, inheritance, and shadow DOM can also matter.

Suggested workflow

CSS debugging workflow

Clean CSS, compare selector weight, then tune responsive values and colors.

Frequently asked questions

What is CSS specificity?

CSS specificity is the weight browsers use to decide which selector wins when multiple rules target the same element.

What does 1-2-3 mean?

The score means 1 ID selector, 2 class-like selectors, and 3 element-like selectors.

Does this tool need a backend workflow?

No backend workflow is required for the public calculator interface; selector parsing and scoring are handled in the browser for this tool.

Does :where() add specificity?

No. This calculator treats :where() as zero specificity, matching modern CSS behavior.