XML XPath Query Tester

Run browser XPath 1.0 on local XML and copy matched values, node paths or scalar results.

On-device No sign-up Free to use

Inspect input controls

Showing an example. Edit to see your own.

Drop your file here

or choose one from your device

Optional UTF-8 text up to 1,000,000 bytes. A chosen file replaces pasted text.

    ?

    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.

    Result

    Showing an example.

    Select Lantern from the namespaced item whose price is greater than 20.

    Lantern
    One text node matches: the name in the second item, whose price is 24.00. The report also gives its namespace-aware node path.

    Loading the tool. Your result will appear here.

    https://usefreetools.net/xml-xpath-query-tester · 20 November 2026

    Was this helpful?

    How to use XML XPath Query Tester

    1. Paste XML or choose one UTF-8 XML file to replace the text. Do not include a DTD or custom entity declaration.
    2. Enter an XPath 1.0 expression. For namespaced elements, map a prefix to the namespace URI in Namespace prefixes JSON and use it in the expression.
    3. Read the matched serialized values and namespace-aware node paths, or the scalar result from count(), string() or boolean(). Copy the output you need; the original XML is unchanged.

    Example: XML XPath Query Tester

    Select Lantern from the namespaced item whose price is greater than 20.

    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
    Lantern One text node matches: the name in the second item, whose price is 24.00. The report also gives its namespace-aware node path.

    Options

    Namespace prefixes
    XPath 1.0 does not apply the XML default namespace to unprefixed element names. Map it explicitly, for example c to urn:example:catalog, and use c:item in the query. The xml prefix retains its standard namespace.
    Result type
    Node selections produce matched values and stable namespace-aware paths. Native scalar expressions such as count(), string() and boolean() produce a number, string or boolean instead. This page evaluates XPath 1.0, not XPath 2.0 or 3.1.
    Input and output bounds
    A selected UTF-8 XML file replaces pasted text and has a 1,000,000-byte cap; pasted XML accepts up to 1 MiB. A selection exceeding the result or output limit is refused instead of returned as a partial match list.

    Supported inputs and limits

    • Pasted XML up to 1 MiB, 5,000 total nodes including attributes and 64 levels.
    • A chosen UTF-8 XML file is limited to 1,000,000 bytes.
    • Expressions accept 500 UTF-8 bytes; namespace JSON accepts 12,000 bytes and 20 mappings, with prefixes up to 40 characters and namespace URIs up to 512.
    • Selections accept at most 1,000 matches and 500,000 UTF-8 bytes including paths.
    • DTDs and custom entities are refused.
    More details

    Diagnostic parsererror elements in Mozilla/XHTML namespaces, or a root named parsererror, are conservatively refused.

    Browser XML/XPath support is required.

    No URL fetch, XML rewriting, schema validation or generated result-file download occurs.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved 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, no external documents are fetched, and copying the result 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.

    Page updated · Project managed by Tony Hines · Report a problem with XML XPath Query Tester