XML Formatter
Format and minify XML documents
About XML Formatter
Indents XML with 2 spaces per level or minifies it by removing the whitespace between tags, after your browser's XML parser confirms the document is well-formed. It suits data-oriented XML such as config files, SOAP messages, sitemaps and RSS feeds, where each element holds either text or child elements, not both.
Category: Encoding.
Frequently asked questions
What does formatting XML do?
▾
It removes the whitespace between tags, then puts each tag on its own line and indents nested elements by 2 spaces. Elements that contain only text stay on one line, and attributes, comments, CDATA sections and the XML declaration are kept as written.
Does it validate my XML?
▾
It checks well-formedness only: your browser's DOMParser must accept the document (a single root, matching and properly nested tags, quoted attributes, no undefined entities) before it is formatted or minified, and its error message is shown otherwise. It does not validate against a DTD or an XML Schema (XSD).
What does Minify remove?
▾
Only the whitespace between tags, such as line breaks and indentation. Comments, the XML declaration, spaces inside tags and the text inside elements are left as they are, so the result is compact but not fully optimized.
Can I format HTML or XHTML with it?
▾
Only well-formed XHTML passes the XML check; unclosed tags like <br> and HTML entities like are rejected. Even then, elements that mix text and tags, such as <p>Hello <b>world</b></p>, can be mis-indented or make Format fail, and Minify removes spaces that sit between two tags, which can join words.