Category: Developer tools

CSS Specificity Calculator

System ideaMissing a tool?

Compare selector specificity as an A-B-C score

Enter one or more CSS selectors and read their ID-class-element (A-B-C) specificity score, sorted so you can see which rule would win. Runs entirely in your browser.

SelectorSpecificity (A-B-C)IDsClasses, attributes, pseudo-classesElements, pseudo-elements
#nav .item > a:hover1-2-1121
.card.featured0-2-0020
button0-0-1001
*0-0-0000

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

When two CSS rules target the same element, the one with higher specificity wins, not the one written last. Specificity is counted as three numbers: A for ID selectors, B for classes, attribute selectors and pseudo-classes, and C for element selectors and pseudo-elements. This tool parses each selector you enter, including :not(), :is(), :has() and the zero-specificity :where(), and reports its A-B-C score so you can compare selectors directly instead of guessing. Every calculation happens in your browser.

How to use it

  1. Enter one selector per line, such as #nav .item > a:hover, pasting each rule you want to compare on its own line.
  2. Read each selector's A-B-C specificity score: A counts ID selectors, B counts classes, attribute selectors and pseudo-classes, and C counts element selectors and pseudo-elements.
  3. Sort by specificity to line the selectors up from strongest to weakest and see which one would win a conflict on the same element.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

How do I use CSS Specificity Calculator?
Enter one selector per line, such as #nav .item > a:hover. Each selector is parsed and shown with its A-B-C specificity score, and sorting by specificity shows which selector would win a conflict.
Which inputs and options does CSS Specificity Calculator support?
It takes CSS selectors typed one per line, including :not(), :is(), :has() and the zero-specificity :where(). It reports A for ID selectors, B for classes, attribute selectors and pseudo-classes, and C for element selectors and pseudo-elements, and it can sort the list by specificity. There are no other options beyond what the page shows.
How do I view or copy the result?
Results appear on the page next to each selector you entered, sorted by specificity, so you can read or select the A-B-C scores directly. There is no export, download or saved-history feature.
Is my input, file, or result uploaded?
No. Inputs, settings and results stay in the browser and are not uploaded to LocalTools. The selectors you paste are parsed on your own device.
What does this tool not support?
It only scores and compares the selectors you type. It does not read or crawl your stylesheet files, and it offers no accounts, sync, cloud history, or formats, algorithms and batch features beyond what the page lists. Tie-breaks decided by source order or !important still have to be judged in your own stylesheet.