XML formatter
Paste XML into the box, then choose pretty print or minify. A parse error shows its line and column, and the page never fetches outside resources.
XML formatter runs entirely in your browser: the text you paste is never sent to a server. It is free and needs no sign-up.
How to use it
- Paste your XML Paste the XML into the box. Input up to 5 MB is accepted. Choose Format, Minify or Validate to decide what the tool does with it.
- Choose indent or minify Format indents with 2 spaces, 4 spaces or a tab. Minify removes the whitespace between elements, but keeps spaces and line breaks inside text and mixed content. Validate only checks that the XML is well formed.
- Read the result Format and Minify show the result in the box, and Validate says whether the XML is valid. An error shows the line and column where parsing failed. Copy the result or download it as an .xml file.
Questions
Why does my XML say it is not well formed?
The most common causes are a tag that is not closed, a closing tag whose case does not match, a bare ampersand or less-than sign inside text, and more than one root element. The error gives the line and column of the first problem, so fix that spot and check again.
Why is an entity such as refused?
The tool accepts the five predefined entities (& < > " and ') and numeric character references. Other named entities are not defined in plain XML, and DOCTYPE internal subsets are refused because they can declare entities. Use a numeric form such as   instead.
Are comments and CDATA kept?
Yes. Comments and CDATA sections are kept when you format or minify. External entities are never read or fetched. Minify removes the whitespace between elements, so check the output before you use it where spaces matter.