DevToolbox

Free Online XPath Tester

Evaluate XPath 1.0 expressions against XML documents in your browser. Supports nodesets, strings, numbers, booleans, and all XPath axes — free, 100% client-side.

100% Client-Side · Your data never leaves your browser
Output appears here…
Quick Reference

How to Use XPath Tester

Paste your XML into the XML Input panel on the left, then type an XPath expression in the XPath Expression field on the right.

  • Click Test or press Ctrl/Cmd+Enter to evaluate the expression.
  • The result type badge shows whether the result is a nodeset, string, number, or boolean.
  • For nodeset results, each matching node is serialized and displayed individually.
  • Click entries in the Quick Reference to insert common XPath patterns.
  • Click Load Sample to load a bookstore XML example and start exploring.

XPath evaluation uses the browser's native document.evaluate() API, so results match exactly what XSLT and browser-side XPath processors produce. No data is sent to any server.

Frequently Asked Questions

What is XPath?

XPath (XML Path Language) is a query language for selecting nodes from an XML document. It uses path expressions to navigate the tree structure. XPath 1.0 is universally supported in browsers via the native <code>document.evaluate()</code> API.

How do I select all elements with a specific name?

Use the double-slash <code>//</code> operator for recursive search. For example, <code>//book</code> selects all <code>&lt;book&gt;</code> elements anywhere in the document, and <code>//title</code> selects all <code>&lt;title&gt;</code> elements at any depth.

How do I select an attribute value?

Use the <code>@</code> prefix before the attribute name. For example, <code>//book/@category</code> returns all "category" attribute values on <code>&lt;book&gt;</code> elements. To filter by attribute value, use <code>//book[@category="fiction"]</code>.

What functions are available in XPath 1.0?

XPath 1.0 includes functions for strings (<code>string()</code>, <code>contains()</code>, <code>starts-with()</code>, <code>normalize-space()</code>), numbers (<code>count()</code>, <code>sum()</code>, <code>number()</code>), booleans (<code>boolean()</code>, <code>not()</code>), and node navigation (<code>last()</code>, <code>position()</code>, <code>name()</code>, <code>local-name()</code>).

Why does my XPath return no results?

Common reasons: (1) The element has a namespace — XPath 1.0 requires namespace-aware handling. (2) The path is case-sensitive — XML element names are case-sensitive. (3) You are using XPath 2.0 syntax (e.g., <code>fn:</code> prefixes) which is not supported by the browser's native XPath 1.0 engine.

Is my XML data safe?

Yes. The XML is parsed and queried entirely in your browser using the built-in DOMParser and document.evaluate() APIs. No data is ever sent to a server. You can safely paste internal XML documents.

Related Tools