b2KIT

CSS Unused Selector Finder

Paste HTML and CSS to find unused selectors with coverage reporting and removal suggestions.

Tested tool guide Tested browser tools Checked August 16, 2026

What CSS Unused Selector Finder does and how it behaves

CSS Unused Selector Finder compares the selectors in pasted CSS with the elements and attributes present in pasted HTML. It reports which selectors find a match, summarizes selector coverage, and flags unmatched selectors as removal candidates. The important surprise is that "unused" means unused by this HTML snapshot, not unused by an entire application. Selectors activated by script, route changes, injected components, user interaction, or states absent from the sample can be reported as unused even though production needs them.

How the result is produced

1

Selector matching

Paste the markup snapshot and stylesheet into their respective inputs. The finder checks CSS selectors against that markup and separates selectors that match at least one element from those that do not. Its coverage report concerns examined selectors, not downloaded stylesheet bytes, declaration counts, cascade importance, or the amount of CSS that visibly affects the rendered page.

2

Removal candidates

Removal suggestions come from selectors with no match in the supplied HTML. A grouped rule can contain comma-separated selectors with different relevance, so inspect the individual selectors before editing the stylesheet. Keep the original CSS until all applicable templates and states have been checked, because this report cannot establish that an unmatched selector is globally dead.

Good uses

  • Audit a page-specific HTML snapshot before extracting unused selectors from a shared stylesheet.
  • Find old class, ID, and attribute selectors left behind after refactoring a component's markup.
  • Compare a template fixture with its CSS before manually reducing a legacy stylesheet.

Limits and checks

  • Classes or attributes added by JavaScript are absent unless the pasted HTML already contains them, so their selectors may appear unused.
  • Selectors for interaction and state, including :hover, :focus, :checked, and state-specific attributes, need manual review when the sample does not represent those states.
  • A matched selector is not proof that its declarations have a visible effect; the cascade, inheritance, invalid values, and overriding rules can still make those declarations ineffective.

Common questions

Does an unused result mean the selector is safe to delete?

No. An unmatched selector is only absent from the HTML you supplied. It may match another route, a server-rendered variant, content inserted after load, or a class added during interaction. Treat the suggestion as a candidate, then search the full project and exercise relevant states before deleting the rule.

Does the coverage report measure how much CSS affects the page visually?

No. A selector can match an element while all of its declarations are overridden, invalid, or visually irrelevant. Conversely, a selector can be needed for a state missing from the sample. This tool answers whether selectors match the pasted HTML; it does not prove that declarations change pixels or that matched rules are worth keeping.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools