Skip to main content

CSS Variables Extractor

New

Paste CSS and extract every custom property declaration and var() usage, with a report of unused and undeclared variables.

csscustom-propertiesvariablesauditlint
Read the guide
Shortcuts:⌘ KSearch
VariableDeclared valueUsedStatus
Continue with:

Frequently Asked Questions

How does it tell the difference between a declaration and a usage?

Declarations are matched as --name: value; pairs (typically inside a selector block like :root), while usages are matched as var(--name) references anywhere else in the stylesheet — the tool tracks both separately and then reports on variables that appear in only one category.

What does "declared but unused" actually mean?

It means the tool found a --variable: value; declaration for that name, but never found a matching var(--variable) reference anywhere else in the pasted CSS — which can indicate dead code, though the variable might still be referenced in a different file you haven't pasted in.

What does "used but never declared" mean, and is it always a bug?

It means var(--variable) is referenced somewhere, but no matching --variable: value; declaration was found in the pasted CSS — this often just means the variable is declared in a different stylesheet (like a shared theme file) that wasn't included in what you pasted, not necessarily a real bug.

Does it understand var() fallback values, like var(--x, blue)?

Yes — the usage regex specifically strips off everything after the first comma inside var(...), so var(--color, blue) is correctly counted as a usage of --color without the fallback value confusing the parser.

Does this check whether the values themselves are valid CSS?

No — it only extracts and lists the raw text following the colon in each declaration. It does not validate whether that value is syntactically correct CSS for its intended use.

Related Tools