XPath Tester

Free. No sign-up. Your input is processed in your browser.

Test XPath 1.0 expressions. Click an element in the tree to get its path.

How to test an XPath expression

  1. Paste your XML.
  2. Type an expression. Matches update as you type.
  3. Or press Pick element and click one to get its path.

Examples

ExpressionResult
//order[total>50]Orders with a total above 50
/orders/order[2]/@idThe id of the second order
count(//order)Number of orders
sum(//total)Sum of all totals

Default namespaces

XPath 1.0 does not apply a default namespace to unprefixed names. In this tool, use the prefix d:, for example //d:item. If a document declares several default namespaces, d: refers to the first one found.

Questions

Is XPath 2.0 or 3.1 supported?

No. The tool uses your browser’s XPath 1.0 engine.

How large can the element tree be?

The tree lists up to 2,000 elements.

Related tools

See all tools