XPath Tester
Paste XML, type an XPath expression, and see every matching node — with its type, name, value, and full serialized form — updating live as you edit.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is XPath Tester?
XPath is a query language for selecting nodes from an XML document. It is the SQL of XML — a small but expressive syntax that lets you reach into any depth of nesting, filter by attribute, and aggregate values. It is also used by XSLT, libxml2, and many scrapers (lxml, Scrapy) to address parts of HTML/XML documents.
This tester evaluates XPath 1.0 expressions using the browser's built-in `document.evaluate` and `DOMParser`. Type a path like `//book[@genre='fiction']/title` and you see every matching node — element, attribute, text, comment, or CDATA — each shown with its name, value, and serialized form. Scalar XPath results (e.g. `count(//book)`, `name(//book[1])`) appear as a single value with the result type indicated.
How to Use XPath Tester
Paste XML into the left panel.
Type an XPath expression in the expression field.
Results update live as you type.
Each match shows the node type, name, value, and serialized XML.
Common Use Cases
- Validating an XPath before using it in a scraper or XSLT transform.
- Finding the right XPath for a specific element in a large XML document.
- Testing attribute selectors and predicates (e.g. //a[@href and not(@target)]).
- Debugging why an XPath returns nothing — see XML parse errors and XPath errors inline.
- Learning XPath syntax through interactive feedback.
Example Input and Output
An XPath with attribute filter selects matching elements.
//book[@genre='fiction']/titleTwo matches: <title>The Great Gatsby</title> and <title>1984</title>Privacy
All XML parsing and XPath evaluation happen in your browser. No content is sent to a server.
Namespaces
Document-default namespaces (xmlns="...") require a namespace-resolver in XPath 1.0. As a workaround, use //*[local-name()="elementname"] to match elements ignoring the namespace.

