Toolspark

CSS Specificity Calculator

Calculate and compare CSS selector specificity scores. Understand which styles take priority.

How CSS Specificity Works

Specificity is represented as four numbers [a,b,c,d]:

  • a - Inline styles (style attribute)
  • b - Number of ID selectors (#id)
  • c - Number of class selectors (.class), attributes ([type]), and pseudo-classes (:hover)
  • d - Number of element selectors (div, p) and pseudo-elements (::before)

Higher specificity values always win. When specificity is equal, the last rule declared wins.