~/frontend-tools/css-variable-checker
CSS Variable Checker
Paste a stylesheet and get a report on its custom properties: which --variables are defined, which are used, which are used but never defined (and whether they have a fallback), and which are defined but never used.
Using the CSS Variable Checker
Why check variables
A typo in a custom property name fails silently: var(--bordr-color) simply resolves to nothing and the property falls back to its initial value. In a large stylesheet these mistakes are hard to spot by eye, which is what this checker is for.
What the report shows
Defined variables with the selectors that set them, variables used with how many times, variables used but never defined in the pasted CSS (an error if there is no fallback, a warning if there is one), and variables defined but never used, which are candidates for clean-up.
Fallbacks
var(--text, #F5F7FA) uses the second value when --text is not set. Fallbacks make components robust when they are dropped into a page without your design tokens, so they are reported as a softer warning.
Limits
The checker only sees the CSS you paste. Variables can also be set in other stylesheets, inline styles or JavaScript, so treat an undefined variable as something to verify rather than a certain bug.
Naming custom properties
Consistent names prevent most variable bugs. A common pattern is category first, then role, then variant: --color-text, --color-text-muted, --space-4, --radius-card. Keep design tokens in one :root block so the checker, and your teammates, can see every definition in one place.
How do I find unused CSS variables?
Paste the stylesheet and look at the defined-but-never-used list. Each entry is a custom property that is declared but never read with var() in the CSS you pasted. Before deleting one, check your HTML and JavaScript, because a variable can also be read or set there.
Worked example: a missing variable
If a rule says color: var(--brand-text) but only --brand-txt is defined, the checker lists --brand-text as used but not defined. Without a fallback the property becomes invalid at computed-value time and falls back to its inherited or initial value, which is often why text suddenly turns black.
Frequently asked questions
Does it check variables set in JavaScript?
No, only CSS text. Paste all your stylesheets together for the most complete picture.
Are case differences treated as different variables?
Yes. Custom property names are case-sensitive, so --Brand and --brand are different.
Is the CSS uploaded?
No, the analysis runs in your browser.
Can I paste several files at once?
Yes. Paste them one after another in the same box. Variables defined in one file and used in another are then matched correctly.
Does it work out which value applies at a given screen width?
No. It reports where each variable is defined and used in the text. Which definition wins depends on the cascade, media queries and the element, which only the browser can resolve.