Developer · CSS
Unused CSS selector checker.
Paste a page's HTML and its CSS to see which selectors match nothing, and roughly how many bytes they take. Runs in your browser; nothing is uploaded.
Input
Result
Paste HTML and CSS, then press Check selectors.
How selectors are tested
Your HTML is parsed with the browser's DOMParser. Each selector from your CSS is then passed to querySelector(). Per the DOM Standard, that method returns the first element matching the selector, or null if there is none. A selector that returns null matches nothing in the HTML you pasted, so it is reported as unused.
Cannot verify statically: whether a:hover, input:focus or a:visited applies depends on what the user is doing, and pseudo-elements such as ::before or ::placeholder depend on rendering, not on the markup. Selectors Level 4 defines the user-action and link-history pseudo-classes as states of an element. The tool strips these, tests the part that remains (a, input), and if that part exists reports the selector as "cannot verify statically" instead of unused. If the remaining part matches nothing, no element could ever be in that state, so the selector is reported as unused. A state pseudo-class inside :not(), :is() or :has() is also reported as cannot verify.
Estimated bytes: the UTF-8 size of the CSS as you pasted it, with comments removed. When every selector in a rule is unused, the whole rule counts (selectors, braces and declarations). When only some are unused, only those selectors and their commas count. It is a source-size estimate before minification and gzip, and the wrapping @media line is not counted.
What this cannot see: classes, ids, attributes and elements that JavaScript adds after load, content injected later, and any page state not present in the HTML you paste. A selector marked unused may be live in a state you did not paste. Check before deleting.
Sources: DOM Standard, ParentNode.querySelector(); Selectors Level 4 (pseudo-elements, section 3; link and target pseudo-classes, section 8; user action pseudo-classes, section 9).
How to find unused CSS selectors with this tool
Paste the markup of the page into HTML and the stylesheet into CSS, then press Check selectors. The result lists selectors that match nothing, selectors it could not verify, selectors the browser rejected, and how many bytes the unused ones take. Use Load example to see the layout of the report first. For a real check, paste the HTML as it looks after the page has loaded and any menus or dialogs you care about are open, because the tool can only test what is in the markup.
Worked example
HTML: <nav class="nav"><a href="/">Home</a></nav><h1 id="t">Hi</h1>
.nav{margin:0}
.nav a:hover{color:red}
.footer{padding:8px}
.btn-primary, h1{font-size:2rem}
@media (min-width:600px){.sidebar{display:block}}
The tool finds 6 selectors in 5 rules and reports:
.footeris unused and it is the only selector in its rule, so the whole rule counts: 20 bytes..btn-primaryis unused but shares a rule withh1, which is used. Only the selector and its comma count: 13 bytes. You would delete.btn-primary,and keep the rule..sidebarinside the@media (min-width:600px)block is unused: 23 bytes. Rules inside media queries are tested too..nav a:hoveris flagged “cannot verify statically”. The tool tests the part without:hover(.nav a), finds that it matches, and leaves the decision to you, because hover depends on the user’s pointer..navandh1match and count as used.
In total 56 of the 112 bytes of CSS measured (half) belong to unused selectors, which is the number to weigh against the risk of removing them.
Why a selector looks unused and is not
Static checks are blind to anything created at run time. The usual causes are classes toggled by JavaScript (.is-open, .modal--visible), elements injected after load (cookie banners, ad containers, chat widgets), classes built from strings ("btn-" + size), and markup that only appears for logged-in users or on another route. If the selector belongs to a state like that, paste HTML captured in that state, or keep the rule.
A safer workflow before you delete CSS
- Run the checker on the HTML of each template or route that loads the stylesheet, not just the home page. A selector is unused only if it is unused on every page that links the file.
- Search your JavaScript and templates for the class name as text. A hit means the class is probably added dynamically.
- Cross-check with a real-browser measure. The Coverage panel in Chrome DevTools records a page while you use it and reports used and unused bytes of CSS, but it only counts what you triggered during the recording.
- Remove in small batches and compare screenshots at a narrow and a wide viewport, with hover, focus and error states exercised.
For a build-time approach, tools such as PurgeCSS scan your content files and remove selectors they do not find, with a safelist for classes that are created dynamically. This page is for a quick, no-install look at a single document.
What the bytes figure means
It is the UTF-8 size of the CSS as pasted, minus comments, split between used and unused selectors. It is measured before minification and gzip, so the saving after compression will be smaller. Treat it as a way to rank where the dead weight is, not as a performance promise.
What is skipped or unsupported
@keyframes and @font-face blocks are not tested, because their contents are not selectors. Nested CSS and Sass or Less syntax are not expanded, so paste compiled CSS. Selectors the browser cannot parse (some vendor-prefixed or very new ones) are listed as “could not test” and are not counted as unused.
Sources
Each source below was opened and checked in October 2026 (retrieved 2026-10).
- DOM Standard, ParentNode.querySelector(): returns the first matching element or null; the basis of the unused test
- Selectors Level 4: user-action and link pseudo-classes and pseudo-elements
- MDN, Pseudo-classes: reference for :hover, :focus and other state-based selectors
- Chrome for Developers, Coverage: used and unused bytes of CSS and JavaScript while interacting with a page
- PurgeCSS: build-time removal of unused CSS and its safelist for dynamic classes
Frequently asked questions
Why is my selector marked unused when the site uses it?
The tool only sees the HTML you paste. If a script adds the class later, such as an open menu or a modal state, paste the HTML with that state applied or leave the selector alone.
What does "could not test" mean?
The browser rejected the selector as invalid or unsupported, so querySelector() threw an error. Vendor-specific or very new syntax can land here. Those rules are not counted as unused.
Does it handle nested CSS or Sass?
No. Nested rules and preprocessor syntax are not expanded. Paste compiled CSS.
Is my code sent anywhere?
No. Parsing and matching happen in your browser tab. The pasted HTML is parsed into a detached document, so its scripts do not run.
How do I find unused CSS on a page?
Paste the page's rendered HTML and its stylesheet into this checker. It runs every selector against the HTML and lists those that match nothing, with the bytes they take. For a measure of a live page, the Coverage panel in Chrome DevTools reports used and unused CSS bytes while you interact with it.
Why are :hover and :focus selectors not reported as unused?
Whether they apply depends on the user's pointer or keyboard, not on the markup. The tool removes the state, tests the rest of the selector, and marks the result "cannot verify statically" if that part exists. If the remaining part matches nothing, no element could ever be in that state, so it is reported as unused.
Does it check every page of my site?
No. It checks the one HTML document you paste against the CSS you paste. A selector reported unused here may be used on another page that loads the same stylesheet, so run it for each template before deleting anything.
Are CSS rules inside @media queries checked?
Yes. Rules inside @media, @supports, @layer and @container are tested like any other. The context is shown next to the selector, and the @media line itself is not counted in the bytes.
Can I just delete everything it lists?
Not without a check. The list shows selectors with no match in the pasted markup. JavaScript-added classes, other pages and unseen states can make a selector live. Review the list, search your scripts for the names, and remove in small steps.
What is the difference between this and a tool like PurgeCSS?
PurgeCSS runs in your build, scans your source files for the names you use and writes a smaller stylesheet. This page is an interactive report on one HTML document and does not rewrite your CSS.
Static check only
This tool reports selectors that match nothing in the HTML you pasted. It cannot see JavaScript-added classes or states, so review the list before deleting any CSS.