CSS Selector Tester

Paste a snippet of HTML and a CSS selector, and the tool lists every element the selector matches, with a count and a short preview of each one.

Use the tool

Why this tool exists

A selector that looks right often matches the wrong thing: a child combinator that skips a wrapper, a class on the parent instead of the child, or a :not() that quietly excludes too much. Testing it against the real page means opening devtools, finding the node and retyping the selector in the console. This tester lets you paste only the relevant markup, try a selector and see the match count immediately.

It is handy when you write scraping rules, Cypress or Playwright locators, stylesheet overrides or querySelectorAll calls. The matching uses the browser's own selector engine, so results agree with what your code will do, and your HTML never leaves the page.

How to use it

  1. Paste the HTML you want to test into the first box.
  2. Type a CSS selector such as li.item > a into the second box.
  3. Read the match count and the list of matched elements below.
  4. Adjust the selector until only the elements you want are listed.

Frequently asked questions

Which selectors are supported?

Anything your browser's querySelectorAll understands, including attribute selectors, combinators, :not(), :nth-child() and :is(). Support for newer pseudo-classes such as :has() depends on the browser you are using.

Why does it say Invalid selector?

The browser refused to parse the selector. Common causes are an unclosed bracket, a stray comma, or an unescaped character in an id or class name. Fix the syntax and the results appear again.

Is my HTML sent anywhere?

No. The markup is parsed into a detached document in your browser, and nothing is uploaded. Scripts inside the pasted HTML are not executed because the parser only builds a tree.

Is the output limited?

The count covers every match, but only the first 200 matches are listed, and each preview is cut at 200 characters. That keeps very large pastes readable.