CSS Specificity Calculator

Calculate selector specificity.

How to use

Four quick steps — paste, run, review, copy. Everything stays in your browser.

Paste your input

Paste your input

Drop CSS, HTML, JSON, or other text into the editor. Nothing is uploaded.

Run the tool

Run the tool

Click Convert or Run. The result appears instantly on this page.

Check the output

Check the output

Read the generated code and any review notes before you ship it.

Copy and use

Copy and use

Copy the output to your clipboard and paste it into your project.

About this tool

Compute classic (a,b,c) specificity so you can see why one rule wins over another without opening DevTools every time.

Example

Example mixes elements and classes — typical of legacy nav CSS.

Input

nav.site-header .menu a.active

Output

Selector: nav.site-header .menu a.active
Specificity: (0,3,2)
IDs: 0
Classes/attributes/pseudo-classes: 3
Elements/pseudo-elements: 2

Tip

If you need !important often, specificity debt is the real bug.