CSS Class Extractor
Extract, filter, count, and format all unique CSS class names from HTML & JSX markup.
Presets:
Sort:
Prefix:
flex3×
items-center3×
transition-colors3×
hover:text-indigo-4002×
max-w-4xl2×
text-white2×
tracking-tight2×
w-full2×
backdrop-blur-sm1×
bg-indigo-6001×
bg-slate-800/501×
bg-slate-9001×
border1×
border-b1×
border-slate-7001×
border-slate-8001×
flex-col1×
font-bold1×
font-extrabold1×
font-medium1×
font-semibold1×
gap-41×
hover:bg-indigo-5001×
hover:text-indigo-3001×
justify-between1×
justify-center1×
leading-relaxed1×
mb-21×
min-h-screen1×
p-61×
p-81×
px-41×
py-121×
py-21×
py-41×
rounded-2xl1×
rounded-lg1×
shadow-lg1×
shadow-xl1×
space-y-81×
text-3xl1×
text-indigo-4001×
text-slate-1001×
text-slate-4001×
text-sm1×
text-xl1×
transition-all1×
Input HTML Size
1,154 B
Unique Classes
47
Total Usage
58
Top Class
flex (3×)
Extracting CSS class names from HTML & JSX
The CSS Class Extractor parses markup to isolate class names from both standard class="..." and React/JSX className="..." attributes. It de-duplicates entries, counts usage frequencies, and exports class names in customizable formats (lists, JSON, Tailwind space-separated strings, or CSS boilerplate).
To format or clean your HTML structure, check out our HTML Formatter. For cleaning or minifying stylesheets, try the CSS Formatter.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Listing every class used in a page's markup.
- Finding which classes appear most often.
- Auditing markup against a stylesheet to find unused rules.
- Producing a class inventory from an inherited template.
- Comparing two pages' class usage to find divergence in a shared template.
Frequently Asked Questions
- Does it read JSX as well as HTML?
- Yes — the matcher accepts `class` and `className`, and values in double quotes, single quotes or backticks. That covers plain HTML, JSX, and template literals, which is where most component markup actually lives.
- What does the frequency count mean?
- How many times the class appears across all elements, not how many distinct elements carry it. In a utility-first codebase the top entries are usually layout primitives, which is a fair signal of what belongs in a shared component.
- Are dynamic class names picked up?
- Only the literal text. A class assembled at runtime — `className={isActive ? 'on' : 'off'}` — yields whatever string literals appear inside the attribute, and a name built by concatenation is not recovered at all.
- Why output classes with a leading dot?
- So the list can be pasted straight into a stylesheet as selectors. The CSS output format goes further and emits each name as an empty rule, which is a quick way to scaffold styles for markup that has none yet.
- Can this find unused CSS?
- It gives you one half of the comparison — the classes markup actually uses. Diffing that against the selectors defined in your stylesheet is what identifies dead rules; the CSS-compare tool is built for that second step.
- Are duplicate classes on one element counted twice?
- Yes, because the value is split on whitespace and each token counted. `class="btn btn"` is redundant markup rather than a parsing artefact, and seeing the count is more useful than silently collapsing it.
Common errors and gotchas
- Extracting from source rather than rendered output, where JavaScript adds classes.
- Assuming an extracted class exists in the stylesheet, which extraction cannot tell you.
- Missing classes built by string concatenation, which no static scan will find.
- Treating the list as a purge candidate set without checking dynamically applied classes.
- Overlooking classes inside inline SVG or template literals.
Related Developer Utilities tools
RegExp Tester
Test regular expressions and inspect matches locally.
Regex Visualizer
Visual regex pattern diagram with live match highlighting and capture group annotations.
Subnet Calculator
Compute CIDR subnets, usable hosts, and network ranges.
Cron Parser
Translate cron syntax into plain English.
URL Parser
Break a URL into protocol, host, path, and query parts.
HTML Previewer
Paste HTML and see it rendered live in a safe, sandboxed preview.
HTTP Status Code Reference
Search and look up every HTTP status code and its meaning.
MIME Type Lookup
Find the MIME type for a file extension, or the extensions for a MIME type.