XPath Tester: Evaluate XPath Expressions Online
An XPath tester evaluates an XPath expression against an XML document and shows exactly which nodes match. Paste your XML, type an expression like //book[price>10]/title, and every matching node is listed instantly, including scalar results from functions like count() and string(). The document's namespaces are detected automatically, with a working prefix offered for the default namespace (the number one cause of "XPath matches nothing").
How it works
- 1
Paste your XML document.
- 2
Type an XPath expression (press Enter or click Evaluate).
- 3
Inspect the matched nodes, or the number/string/boolean result for function expressions.
Frequently asked questions
How do I test an XPath expression online?
Paste the XML above, enter the expression, and click Evaluate. Node-set results are listed as serialized XML fragments; expressions like count(//item) or boolean(//error) return their scalar value directly.
Why does my XPath return no results when the element clearly exists?
Almost always namespaces. If the document declares a default namespace (xmlns="..."), unprefixed names in XPath 1.0 match nothing. Use the d: prefix this tool maps to the default namespace (//d:book), or the namespace-agnostic form //*[local-name()='book'].
What XPath version does this tool support?
XPath 1.0, evaluated by the browser's native engine. This is the same version used by most XML tooling, XSLT 1.0, and libraries like lxml's default evaluator. XPath 2.0+ features (regex matching, for expressions, date functions) are not available in browsers.
How do I select attributes with XPath?
Prefix the attribute name with @: //book/@category selects the attribute nodes themselves, and //book[@category='fiction'] uses the attribute as a filter predicate.
Can I use XPath functions like count() and contains()?
Yes. All XPath 1.0 functions work: count(//book), sum(//price), contains(title, 'XML'), starts-with(), normalize-space(), position(), last(), and the rest.
Related tools
Parse XML online into an explorable tree: elements, attributes, text and namespaces, plus parse-error diagnosis. Free and browser-based, no signup.
Validate XML against an XSD schema online. Full W3C XML Schema validation with line-numbered error messages. Free, no signup, results in seconds.
Analyze XML online: element counts, depth, namespaces, attributes, size stats and well-formedness with a structure health report. Free, in-browser.
Test XML online: well-formedness testing, structure stats, XPath-style element lookup, and live endpoint testing for XML APIs. Free, no signup.
Free XML formatter: beautify, pretty-print, tidy and indent XML online, or minify it to one line. Idempotent formatting, no signup, no upload limit.