Contact

Tools  /  CSS  /  CSS Selector Tester

CSS Selector Tester

Type a selector and see exactly which elements it matches in a live-rendered HTML snippet -- matched nodes are outlined in the preview and listed below, with the selector specificity and full :has()/:is()/:not() support.

What this tool does

Runs a real selector against a real, sanitized, rendered copy of your HTML using the browser's own querySelectorAll() — every matching element is outlined live in the preview, so there's no guessing whether a selector is right; the browser's actual matching engine answers directly.

Full modern selector support

Because it uses the browser's real selector engine, every modern selector works exactly as it would in production — combinators, attribute selectors, :nth-child(), and the relational :has() pseudo-class alongside :is() and :not() — not a subset a hand-written parser happens to support.

Seeing what matched

Matched elements are visually outlined directly in the rendered preview, a match count and specificity are shown above it, and a list of each match's outerHTML snippet appears below — three different views of the same result, useful for confirming both "did it match" and "did it match the RIGHT element."

Ready-made snippets and examples

Six HTML snippets — a nested list, a table, a form, a nav bar, a card grid, and an article — give realistic markup to test against without writing any HTML first, and 13 example selectors demonstrate common patterns from simple class matching through :has(> li.active).

Privacy and safety

Pasted HTML is sanitized before rendering — scripts, styles, and event-handler attributes are stripped — and everything runs entirely in your browser, nothing is sent to a server.

Frequently asked questions

Is my HTML or selector uploaded anywhere?
No. Parsing, matching, and rendering all happen entirely in the browser -- nothing is sent to a server.
Is this a hand-written selector parser, or the real browser engine?
The real thing -- it calls the browser's own querySelectorAll() against a rendered copy of your HTML, so every selector behaves exactly as it would in production, including :has(), :is(), :not() and anything else the browser supports.
Is it safe to paste HTML from an untrusted source?
The HTML is sanitized before rendering -- scripts, styles, iframes, and event-handler attributes like onclick are stripped -- though pasting HTML from a source you don't trust is still worth some caution.
How can I tell if my selector matched the wrong element?
Matched elements are outlined directly in the rendered preview, and each match's outerHTML is listed separately below it -- so a selector that matches the wrong element (not just the wrong count) is easy to spot.
Does it support :has()?
Yes -- since matching runs through the real browser engine, the relational :has() pseudo-class works exactly as it does in production CSS, not as an approximation.
What happens if I type an invalid selector?
The actual browser error message is shown directly, rather than a generic failure -- useful for spotting a typo or an unsupported syntax.
Theme Accent