Developer Tools

XML Formatter & Validator

Make XML readable with consistent indentation, or minify it to save space. The formatter also checks that your XML is well-formed and tells you where it breaks.

Format XML

Paste XML or open a file such as an .xml, .svg or RSS feed.

How to Format XML

  1. Paste XML or press Open File. Sitemaps, RSS feeds, SVG images, Android layouts, SOAP messages and config files all work.
  2. Choose the indentation and whether to pretty print or minify.
  3. Press Format XML. If the XML is not well-formed, you will see the parser's error message with the line where it failed.

What "Well-Formed" Means

  • There is exactly one root element.
  • Every opening tag has a matching closing tag, or is self-closing like <br/>.
  • Tags are properly nested and match in case: <Item> must close with </Item>.
  • Attribute values are in quotes.
  • Special characters are escaped: & must be written &amp; and < as &lt; inside text.

This tool checks well-formedness. Checking against a schema (XSD or DTD) is a separate step usually done by your application or IDE.

What Is Preserved

Element names, namespaces, attributes, CDATA sections, comments and processing instructions are kept. Whitespace-only text between tags is replaced by the new indentation, and leading and trailing spaces inside text are trimmed. Comments are removed when minifying.

Privacy

XML is parsed by your browser and never uploaded.

Frequently Asked Questions

How do I check if my XML is valid?

Paste it and press Format XML. Well-formed XML is formatted and confirmed in green; otherwise the parser error and location are shown.

Can I format an XML sitemap or RSS feed?

Yes. Any XML document works, including sitemaps, RSS and Atom feeds, SVG files and SOAP messages.

Does formatting change my data?

Only whitespace between elements changes. Text values have leading and trailing spaces trimmed, which matters only for whitespace-sensitive documents.

Is my XML uploaded?

No. Everything happens in your browser.