🎨 CSS Variable Extractor
Extract CSS custom properties from a stylesheet into a clean variable list. Runs in your browser.
Last updated: November 8, 2026 · By the BoltQuickTools team
Listing the custom properties in a stylesheet
When you take over a theme or audit a design system, you may want every --name: value declaration in one place. This page pulls them out of pasted CSS so you do not have to scroll for them.
Running it
Paste your stylesheet into CSS Input. Extracted Variables updates as you type, and the count below the buttons shows how many were found. The Extract button repeats the same step. Load Sample fills in an example, Copy Variables copies the list, and Clear empties both boxes.
Input and output
Given the sample:
:root {
--bg-primary: #0a0a0f;
--accent: #facc15;
--radius: 8px;
}
.card { background: var(--bg-primary); border-radius: var(--radius); }
the result is the following, and the counter reads "3 variables found":
--bg-primary: #0a0a0f;
--accent: #facc15;
--radius: 8px;
The var() references are not listed, only declarations. The result is a plain list with no surrounding block, so wrap it in :root { } if you want to paste it back as CSS.
What one pattern match can and cannot do
The extractor is a single regular expression: a name beginning with --, a colon, then everything up to the next semicolon. It knows nothing about selectors, comments or strings. In practice that means:
- A missing final semicolon swallows what follows.
:root { --b: 2 }followed by.x { color: red; }gives--b: 2 }, a line break, then.x { color: red;all as one value. - Scope is lost.
.dark { --bg: #000; }and.light { --bg: #fff; }come out as two--bglines with nothing to say which theme each belongs to. Duplicates are kept. - Commented-out variables are included.
/* --old: red; */appears as if it were active. - Semicolons inside a value cut it short.
--icon: url(data:image/png;base64,AAAA);comes out as--icon: url(data:image/png;. - Names must be ASCII letters, digits, hyphens and underscores.
- Multi-line values keep their line breaks and indentation. A font stack split over two lines stays split.
Other file types and missing variables
Can I paste HTML or a Sass file?
Yes, since the pattern ignores file type. Inline styles such as style="--w: 10px;" are picked up, provided the semicolon is there. Sass $variables are not matched, only names starting with --.
Does it find variables that are used but never defined?
No, it does not look at var() at all, so it cannot tell you about missing or unused variables. A text search for the name is the quickest way to check.
Should I strip comments first?
Delete commented-out blocks by hand if they are getting in the way. The CSS minifier does strip comments, but it also removes the last semicolon in each block, which triggers the swallowing problem above, so it makes a poor first step here.
What can I do with the list?
If your variables are colors, you can test pairs from it in the contrast checker.