Images & colour
Practical guide: CSS Specificity Calculator
Use CSS Specificity Calculator when you need a quick way to work through this task. Calculate the specificity score of a CSS selector. This guide walks through a small example and the checks to make before you use the result.
When a style does not apply, compare the selectors before adding more classes or important declarations. Specificity measures the relative weight of selectors using IDs, classes and element names.
How to use the tool
- Open the tool and start with the worked example below.
- Paste a CSS selector to see its specificity score and which rule would win a conflict.
- Verify the result against the example before using it in your project.
Try a small example
Example input or settings
#nav .item versus .menu .item: the ID selector has higher specificity.
What to check
Compare #nav .item with .menu .item. The first has higher specificity. Test both in the same layer and without important declarations.
Does higher specificity always win?
No. Cascade origin, importance and layers are considered first. Source order also matters when specificity ties.
When this is useful
For a real task, replace the sample with your own input and check the output in its final context. Keep a copy of the original if the change is hard to reverse.
Before you rely on the result
Preview at the size and on the background where the result will appear. Check file format, legibility and accessibility.