CSS selector tester
Paste HTML on the left, type a selector on the right. Scripts are stripped before parsing — HTML is never rendered as a live page.
HTML
Selector
Matches
element(s) matched
Source highlight
Selector reference
- :has()
- :has(.icon) — parent if it contains a match
- :is() / :where()
- :is(h1, h2, h3) — pick one; :where() counts as zero specificity
- :nth-child(An+B of S)
- li:nth-child(2n+1 of .active)
- Attribute
- [href^="https"] [data-state="open"]
- Combinators
- .a > .b (child), .a + .b (adjacent), .a ~ .b (sibling)
About this tool
Test selectors against sample markup before you ship CSS. The HTML is parsed with DOMParser in memory — script tags are removed and nothing runs in the page.
For full specificity breakdowns across multiple selectors, use theCSS specificity calculator.
Invalid selectors return a parse error instead of silently matching nothing. The match list shows tag, id, classes, and a DOM path so you can spot off-by-one :nth-child mistakes. Pseudo-elements like ::before are not selectable targets. Because scripts are stripped, selectors inside removed script tags will never match — that is intentional for safe testing.