Data / Query
XPath / Selector Playground
Test XPath and CSS selectors against any HTML / XML you paste.
Runtime: Native DOMParser + document.evaluate
Document
XPath expression
0 matches
No matches.
About this playground
Paste an HTML or XML document plus an XPath expression (or a CSS selector). The tool parses the document with the native browser DOMParser, runs the query, and shows every matching node with its outerHTML. Useful for web scraping, RSS parsing, and SOAP debugging.
FAQs
XPath 1.0 or 2.0?
Browser-native XPath is 1.0. Functions like //a[@class='nav'], count(), name(), //*[contains(text(), 'foo')] all work. XPath 2.0 features like string-join and regex-match don't.
Does this work on real-world HTML?
Yes - the parser runs in HTML mode for HTML input, so it auto-closes tags and tolerates the usual web sloppiness. For strict XML, switch to XML mode.
Can I use CSS selectors instead?
Yes - toggle the mode to 'CSS selector'. Anything querySelectorAll accepts (including :has(), :is(), :where()) is supported.
Does it run my page's JS?
No - only the parser runs. <script> tags in your input are parsed but not executed, so it's safe to paste any HTML you find online.