# CSS Selector Specificity Calculator

> CSS Selector Specificity Calculator is a paid API for AI agents from css-design-calc.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Calculates CSS selector specificity (IDs, classes, types) per Selectors Level 4, including :is(), :not(), :where(), and :has(), and optionally compares two selectors to determine which wins in the cascade.

## Facts

- Endpoint: GET https://css-design-calc.x402tookit.com/css-specificity?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/css-selector-specificity-calculator-06a6ab50
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4TWVUoYcOP2Ke1puooNh2

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability css-selector-specificity-calculator-06a6ab50
```

Example prompt: What's the specificity of nav ul > li.active a:hover, and does it beat #main .content p in the cascade?

## When to prefer this

Use this endpoint when you need programmatic, standards-compliant CSS specificity computation per Selectors Level 4, especially when working with modern pseudo-classes like :is(), :not(), :where(), and :has() that have non-obvious specificity behavior. Prefer this over manual calculation for complex selectors or when debugging cascade conflicts between two competing rules.

## Known failure modes

- Invalid or unparseable selector returns valid:false with reasons array explaining parse errors
- Unsupported pseudo-classes may appear in notChecked array
- Malformed comma-separated selector list may result in partial results
- Missing required selector query parameter returns an error response
- Very complex or deeply nested selectors may produce degraded:true with partial results

## How this service works

CSS selector specificity (ids, classes, types) per Selectors Level 4, including :is(), :not(), :where() and :has(); compare two.

## Output

Returns a structured object containing per-selector specificity breakdowns (a/b/c triple, ID count, class count, type count, formatted specificity string), a summary, and if a second selector is provided, a comparison object indicating which selector wins in the cascade, why, and the detail explanation. Also includes validity flags, any selectors not checked, and disclaimers.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "selector"
     ],
     "properties": {
      "selector": {
       "type": "string",
       "description": "A selector or comma separated list, e.g. nav ul > li.active a:hover"
      },
      "compareTo": {
       "type": "string",
       "description": "A second selector; says which wins in the cascade (same origin, no !important)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "valid": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "highest": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "selectors": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "a": {
          "type": [
           "null",
           "number"
          ]
         },
         "b": {
          "type": [
           "null",
           "number"
          ]
         },
         "c": {
          "type": [
           "null",
           "number"
          ]
         },
         "idCount": {
          "type": [
           "null",
           "number"
          ]
         },
         "selector": {
          "type": [
           "null",
           "string"
          ]
         },
         "typeCount": {
          "type": [
           "null",
  
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/css-selector-specificity-calculator-06a6ab50/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from css-design-calc.x402tookit.com](https://www.zero.xyz/host/css-design-calc.x402tookit.com/llms.txt)
