XML XPath Query Tester

Run a native XPath 1.0 expression against pasted XML and inspect bounded node or scalar results.

Inputs stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Inspect input controls

Showing an example. Edit to see your own.

Up to 1 MiB, 5,000 total nodes and 64 levels. DTD and custom entities are refused.

Up to 500 UTF-8 bytes. Use count(...), string(...) or boolean(...) for scalar results.

XPath does not automatically apply an XML default namespace. Assign it a prefix here and use that prefix in the expression.

Processed in your browser. Your inputs stay on this device.

How to use XML XPath Query Tester

  1. Paste XML without a document type or custom entities.
  2. Enter an XPath expression and any namespace mappings.
  3. Review the matched nodes or scalar value and their displayed paths.

Example: XML XPath Query Tester

<root><item>A</item><item>B</item></root> with /root/item.

You add
XML document: <catalog xmlns="urn:example:catalog"> <item id="A1"><name>Rope</name><price>12.50</price></item> <item id="B2"><name>Lantern</name><price>24.00</price></item> </catalog> XPath 1.0 expression: //c:item[c:price > 20]/c:name/text() Namespace prefixes JSON: {"c":"urn:example:catalog"}
You get
XPath matched 1 nodes. Sample rows: 1 | /*[local-name()='catalog' and namespace-uri()='urn:example:catalog'][1]/*[local-name()='item' and namespace-uri()='urn:example:catalog'][2]/*[local-name()='name' and namespace-uri()='urn:example:catalog'][1]/text()[1] | Lantern.

Options

Namespace prefixes
Map the document namespace to a query prefix explicitly. An XML default namespace is not automatically used for unprefixed XPath names.
Expression result
Node selections list matched values and paths. count(), string() and boolean() return scalar values rather than node lists. The supported grammar is browser XPath 1.0.

Supported inputs and limits

Native browser XPath 1.0 only; no XPath 2.0/3.1, URL fetching or XML rewriting. Document size, depth, expression and result count are bounded. DTDs and custom entities are refused before parsing. Namespace prefixes must be mapped explicitly. Up to 1 MiB of XML, 5,000 nodes including attributes, 64 levels, 500 expression bytes and 1,000 matches. Output including paths is capped at 500,000 bytes; at most 20 namespace mappings. XML containing parsererror elements in Mozilla/XHTML diagnostic namespaces, or any root named parsererror, is conservatively refused even if supplied as ordinary content.

Where your input is processed

This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

No matches can be a namespace problem

Check the root namespace and the prefix map before changing a query that unexpectedly returns nothing. A successful query selects information from the supplied document; it does not validate the document against a schema. DTDs and custom entities are refused, and no external documents are fetched. The export leaves the original XML unchanged.

Questions about XML XPath Query Tester

Why does an unprefixed path miss namespaced elements?

XPath 1.0 does not use the XML default namespace for unprefixed element names. Add a prefix mapping and use that prefix in the expression.

Can it evaluate count() or boolean()?

Yes. Native scalar expressions return a number, string or boolean rather than a node list.

Does it load external entities?

No. Inputs declaring a DTD or custom entity are refused; the tool never fetches XML from a URL.

Project manager: Tony Hines · Content updated 4 October 2026 · Report a problem