XPath Tester

Client-sideNo sign-upFree

Run an XPath expression against XML and see matched nodes, using the browser’s native evaluator.

Quick facts

Category
Formatters & Beautifiers
Best for
Working out the right XPath expression before hardcoding it into a scraper or XSLT
XML input
✗ XML error: Loading...
Matched nodes
// Fix the errors on the left to see matches
Runs your expression through the browser's own document.evaluate() - the standard, built-in XPath 1.0 engine every browser ships, not a reimplementation. Matched element nodes are serialized back to XML text via XMLSerializer before being shown, never rendered as raw HTML. The underlying DOMParser never resolves external entities or DTDs, so a crafted external-entity reference in your input can't reach the network or filesystem. Want to browse the same document as a tree instead of querying it? Try the XML Parser.
In-content slot
Was this tool helpful?
On this page

Overview

Paste XML, write an XPath expression, and see exactly which nodes match - powered by document.evaluate(), the standard XPath 1.0 engine every browser already ships, not a reimplementation. Element matches are serialized back to readable XML text; attribute or text-node matches show their value directly. Invalid XPath syntax is caught and reported as a clear error rather than crashing the page, and a query with no matches is reported honestly instead of silently showing nothing. Runs entirely client-side, including the underlying DOMParser step, which never resolves external entities or DTDs.

Best for: Working out the right XPath expression before hardcoding it into a scraper or XSLT

How to use this tool

  1. Paste your XML. Any well-formed document you want to query against.
  2. Write an XPath expression. Element selection, attribute predicates like @id, text(), and more.
  3. document.evaluate() runs it. The browser’s built-in XPath 1.0 engine evaluates the expression against the parsed document.
  4. See matched nodes as text. Matches are serialized back to XML (or shown as text) - never rendered as raw HTML.

Why use this tool

Native engine, no reimplementation

Uses document.evaluate() - the same XPath engine your browser already uses for anything else that needs one.

Clear error handling

Invalid XPath syntax is caught and shown as a message instead of crashing.

Safe node rendering

Matched nodes are serialized to text via XMLSerializer, never injected as HTML.

No external entity resolution

The underlying DOMParser is a browser platform guarantee against XXE - it never fetches external entities or DTDs.

Frequently asked questions

Whatever document.evaluate() supports in your browser, which is XPath 1.0 - the standard supported natively across browsers. It covers the common cases: element/attribute selection, predicates like [@id='2'], text(), and axis navigation.

document.evaluate() throws a DOMException for invalid syntax, and this tool catches that exception and shows its message directly rather than letting it crash the page or silently returning nothing.

No - the XML Parser renders the whole document as a browsable tree. This tool answers a narrower question: which specific nodes match a given XPath expression, which is a different (and often faster) way to explore or debug a large document.

Explore more free tools

Formatters, converters, validators, and generators - all free and running entirely in your browser.

Browse more tools