XML Viewer, Formatter & Validator
View, format and validate XML as a tree or table, test XPath, check or generate an XSD and run XSLT. Runs in your browser.
Runs in your browser. Nothing is uploaded.
Paste JSON to see it as a table.
How to use the XML Viewer, Formatter & Validator
- Paste XML into the left box, open a file, or press Load example for a sample that suits the open tab.
- The bar under the box checks the XML as you type. If it isn't well-formed, it shows the line and column, and Go to error jumps there.
- Use Format to indent it or Minify to put it on one line, then copy or download the result.
- Switch tabs to work with the same XML: browse it as a Tree, run an XPath query, check it against or generate an XSD, or apply an XSLT stylesheet.
A workbench for XML
XML often arrives as one long line from an API, a log or an export, and before you can do anything with it you need to read it. Paste it here and it is checked and indented straight away. From there you can keep working on the same document without copying it between sites: find a value in the tree, test the XPath your code will use, check the file against its schema, or try a stylesheet.
Format, minify and check
The status bar under the input checks the XML on every change. Unclosed tags, mismatched names, a stray
&, a missing quote or a second root element are reported with the line and column, and Go to error
moves the cursor there. Once it is well-formed, Format indents it with two spaces, four spaces or
tabs, and can put each attribute on its own line when elements carry many of them. Minify does the
opposite, removing the whitespace between tags to make files and payloads smaller.
Tree
Large documents are easier to explore than to read. The tree shows each element with its attributes and a short preview of its text, opens branches only when you need them so big files stay fast, and gives you the exact path of any node, ready to use as an XPath.
Table
Feeds, exports and API responses usually repeat one element many times: a <book> per book, an
<item> per order line. The Table tab shows those repeated elements as rows, with a column for each
attribute (@id) and child element, so you can compare values side by side. Click a column to sort, type
to filter, open nested elements as their own table, and copy or download the view as CSV. Paths are shown
as XPath, ready for the XPath tab or your code.
XPath
Type an expression and see every matching node, attribute or value as you type, with its path. It
supports XPath 3.1, including functions such as count(), contains() and string-join(), so you can
test the query before putting it in code.
XSD: validate or generate
Paste a schema on the Validate tab and the XML is checked by the same libxml2 engine used by many servers, with each problem listed by line. If you don’t have a schema yet, Generate infers one from your sample, with types for numbers, dates and true/false values. Press Validate with this schema to test it straight away.
XSLT
Write or paste a stylesheet and see the transformed output, with a live preview when it produces HTML.
Parameters for <xsl:param> can be set without editing the stylesheet.
Everything runs locally in your browser, which makes it safe for private or production data.
Frequently asked questions
What is the difference between well-formed and valid XML?
Well-formed XML follows the basic syntax rules, such as every tag being closed and attribute values being quoted. The status bar checks that. Valid XML also matches a schema that says which elements and values are allowed; use the XSD tab with your schema for that.
Does formatting change my data?
Only whitespace changes. Indentation between tags is rewritten and spaces at the start and end of element text are trimmed. Attribute values, comments, CDATA sections and processing instructions are kept, unless you tick Remove comments.
Why does minifying keep some spaces?
Spaces can matter in mixed content, where text sits next to tags as in <p>Hello <b>world</b></p>, and inside elements marked xml:space="preserve". Those are kept; everywhere else the indentation and line breaks between tags are removed.
How do I query XML that uses namespaces?
On the XPath tab, use the prefixes declared in the document, such as //soap:Body. Names without a prefix, such as //book, match the root element's default namespace (xmlns="..."), so you can write them as they appear.
Do the XPath, XSD and XSLT tabs slow the page down?
No. Each engine downloads only the first time you open its tab, and it runs in your browser after that.
Is my XML uploaded?
No. Everything runs in your browser, so configuration files, SOAP payloads and internal feeds never leave your device.
Tutorials
How to find and fix errors in invalid XML
Use the XML formatter's live check to locate an unclosed tag and an unescaped ampersand, fix them one by one, and confirm the document is well-formed.
How to make XML from an API readable
Turn a one-line XML response into indented, readable XML, find the values you need, and keep the content exactly as it was.
How to select XML elements with XPath
Learn the XPath expressions you will use most, from simple paths to filters on attributes and values, by trying them on a sample document.