Zero Signup ToolsFree browser tools

Developer Tools

CSS Variables Extractor

List every CSS custom property in pasted CSS or HTML. Group by selector, classify by type, spot conflicts and orphans, export as :root, JSON, SCSS, or JS.

1163 chars

The extractor reads CSS rules, embedded <style> blocks, and inline style attributes. Everything runs in your browser. The CSS or HTML you paste here is never uploaded.

Summary

  • Unique variables

    19

  • Declarations

    22

  • var() usages

    10

  • Conflicts

    3

    Same name, different values

  • Used, not declared

    0

  • Declared, not used

    9

Variables

Click a kind to filter the list and the export below.

NameValueKindUsesDeclared inCopy
--color-border
rgba(15, 23, 42, 0.08)
+1 other value
Color0:root, [data-theme="dark"]
--color-brand
#2563eb
Color1:root
--color-brand-hover
#1d4ed8
Color1:root
--color-muted
#64748b
Color0:root
--color-surface
#ffffff
+1 other value
Color1:root, [data-theme="dark"]
--color-text
#0f172a
+1 other value
Color0:root, [data-theme="dark"]
--duration-fast
120ms
Duration1:root
--ease-standard
cubic-bezier(0.4, 0, 0.2, 1)
Easing1:root
--font-mono
ui-monospace, SFMono-Regular, Menlo, monospace
Font0:root
--font-sans
ui-sans-serif, system-ui, -apple-system, sans-serif
Font1:root
--gradient-hero
linear-gradient(135deg, #2563eb 0%, #7c3aed 100%)
Gradient0:root
--radius-lg
16px
Length0:root
--radius-md
8px
Length1:root
--radius-sm
4px
Length0:root
--shadow-card
0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.08)
Shadow1:root
--space-1
4px
Length0:root
--space-2
8px
Length1:root
--space-3
16px
Length1:root
--space-4
24px
Length0:root

Export

Pick a format. The export reflects the current filter.

:root {
  --color-border: rgba(15, 23, 42, 0.08);
  --color-brand: #2563eb;
  --color-brand-hover: #1d4ed8;
  --color-muted: #64748b;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --duration-fast: 120ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
  --gradient-hero: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --radius-lg: 16px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
}

Declared, never used

These variables are declared but the input never calls var() on them. They could be dead code, or they could be consumed by a stylesheet not pasted here.

  • --color-border
  • --color-muted
  • --color-text
  • --font-mono
  • --gradient-hero
  • --radius-lg
  • --radius-sm
  • --space-1
  • --space-4

How to use

  1. Paste a stylesheet, an SCSS file, or any HTML containing <style> blocks or style attributes into the input. Click Load sample to see a worked example with colors, spacing, fonts, durations, gradients, and a dark theme override.
  2. Read the summary cards: unique variables, total declarations, total var() usages, conflicts (same name, different values), used but never declared, and declared but never used.
  3. Use the kind filter chips above the table to keep only colors, lengths, durations, fonts, or any other category. The filter also reshapes the export below.
  4. Pick an export format: :root CSS, JSON, SCSS variables, or a JS token object. Click Copy export to grab the result.
  5. Review the audit boxes at the bottom to find references to variables that are not declared in the pasted input, and declarations that no rule references through var().

About this tool

CSS Variables Extractor scans a block of CSS, SCSS, or HTML and lists every custom property declaration (--name: value) found, the selector or rule each declaration appears under, and the number of times each variable is referenced through var(). The parser is comment-aware and handles the messy real-world inputs people paste into a sandbox: multi-line values, nested parentheses inside linear-gradient and box-shadow values, string literals with embedded semicolons, the new CSS Nesting syntax, multiple :root blocks across themes, embedded <style> blocks, and inline style= attributes. Each variable is classified as a color, length, percentage, duration, easing, number, font, gradient, shadow, keyword, string, url, calc expression, or a var() reference, so the output reads like a design-token table instead of a flat dump. The extractor also surfaces three audit signals at a glance: name conflicts (the same --variable assigned different values across selectors, which is normal inside dark-mode overrides but worth a second look elsewhere), used-but-never-declared variables (referenced through var() but missing from the input), and declared-but-never-used variables (potential dead code if the rest of the codebase is also pasted in). Four export formats are available with one click: a :root CSS block ready to paste into a stylesheet, a JSON object for design-system tooling, a SCSS list ($name: value;) for migration, and a JavaScript token object for theme files. Filtering the variables table by kind (only colors, only lengths, only durations, and so on) also filters the export so a designer can grab just the color tokens or just the spacing scale. Everything runs in the browser; the CSS or HTML you paste here is never uploaded.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools