XPath Tester

Test XPath 1.0 expressions against XML in your browser. Inspect matching nodes, attributes and scalar values, including XML with namespaces.

Namespace bindings

XPath results

Enter XML and an XPath expression to see the result.

Test XPath expressions against XML

Paste XML or open a UTF-8 file, enter an XPath expression, and select Evaluate XPath. Use the browser’s XPath 1.0 evaluator to try a selector before using it in an integration, test, or script. The input and results stay in your browser.

Read and use the result

XPath can select nodes or return a string, number, or Boolean. Element matches appear as XML, while attributes and text nodes show their values. Load the example and use //ns:book/@id to get book IDs or count(//ns:book) to count books. Copy the result when you need it elsewhere.

Query XML with namespaces

Use the prefixes declared on the XML root or add your own under Namespace bindings. For example, b=urn:books lets you query //b:book. When the root declares a default namespace, the tester assigns an available prefix such as ns and shows it with the result. Use that prefix in element names even if the original XML uses none.