XML Formatter & Validator

Free XML formatter, validator and viewer. Pretty-print or minify XML, find errors by line and column, and browse it as a tree. Private, in your browser.

Paste XML (a sitemap, RSS feed, SOAP response, Android layout, SVG or config file) to re-indent it, compress it onto one line or browse it as a collapsible tree. The browser's own XML parser checks that it is well-formed and reports the first error with its line and column. Formatting uses the xml-formatter library and everything happens on your device.

Runs in your browser. The processing engine downloads once on first use, then the tool works offline. Your files never leave your device. Free, no sign-up.

Features

How to use XML Formatter & Validator

  1. Paste XML or open a .xml file.
  2. Read the validation result: well-formed, or the first error with its line and column.
  3. Pick Format (with indent size), Minify or Tree.
  4. Copy or download the result.

Frequently asked questions

What is the difference between well-formed and valid XML?

Well-formed XML follows the basic syntax rules: one root element, every tag closed and properly nested, attribute values quoted and special characters escaped. Valid XML is also well-formed and additionally matches a schema such as a DTD or XSD. This tool checks well-formedness; it does not validate against a schema.

Why does my XML show "Extra content at the end of the document"?

XML must have exactly one root element. That error usually means there are two top-level elements, or stray text after the closing root tag. Wrap everything in a single parent element.

How do I put an & or < inside XML text?

Escape them as &amp; and &lt; (and &gt;, &quot;, &apos; where needed), or wrap the text in a CDATA section such as <![CDATA[ a < b & c ]]>. A bare & is the most common reason an XML file fails to parse.

Does formatting change my data?

Formatting only adds or removes whitespace between tags. Whitespace inside text content can matter in some formats (mixed content, xml:space="preserve"), so keep the original if exact text spacing is important.

Is my XML uploaded?

No. Parsing uses your browser's built-in DOMParser, and the formatter library is loaded once from a CDN; the XML itself never leaves your device.

Related tools

All free tools · This tool as Markdown