Free online tool

XML Formatter & Validator

Inspect XML structure and preserve inline text

Upload a file

Drop your file hereTap to choose a file

or click to browse, or paste from the clipboard

Format element hierarchies

Apply two or four spaces to nested element-only content. Choose Minify to remove indentation from those sections.

Respect text boundaries

Mixed text and elements, CDATA and xml:space="preserve" regions keep their text during formatting.

Check syntax locally

The browser checks well-formedness and reports malformed markup. A valid result can be downloaded as UTF-8 XML.

How to use the XML Formatter & Validator

  1. 1

    Paste XML containing one document element.

  2. 2

    Choose the indentation and select Format, or select Minify to remove indentation between elements. Validate checks XML syntax.

  3. 3

    Review the result and copy it or download document.xml.

What people use this tool for

  • Inspect a sitemap or XML feed.
  • Check a configuration for mismatched tags.
  • Make structured XML easier to read.

Frequently Asked Questions

Does this validate against an XSD or DTD?

It checks well-formed XML. Schema validation is outside this tool. Documents with a DOCTYPE are rejected.

How is whitespace handled?

Element-only blocks can be reindented. Text, CDATA, inline spaces and xml:space="preserve" sections are preserved. The XML serializer may normalize quote style, character references and empty tag syntax.

Which documents can I format?

Use XML of up to 524,288 characters. The formatter limits layout depth and generated indentation for deeply nested documents.