XML Formatter & Minifier

Indent XML to read it, or strip it back down. Nothing is uploaded.

The parts that are not markup

A > inside an attribute value does not end the tag, and everything inside <![CDATA[ ]]> is content however much it looks like elements. Formatters that work by pattern matching get both wrong and produce a file that no longer parses — which is why this one reads the document as tokens.

An element holding nothing but a short piece of text is kept on one line; spreading <name>Ann</name> over three lines makes a document harder to read, not easier.

Namespaces, entities and the parts that look like markup

A prefix such as soap: or xsi: is part of the element name, not decoration, and is preserved exactly. Declared entities are left as written rather than expanded, because expanding them changes the document.

The five predefined entities — &lt;, &gt;, &amp;, &quot; and &apos; — stay escaped. Unescaping them would produce a document that no longer parses, which is a surprisingly common way an XML "formatter" corrupts a file.

Frequently asked questions

Is my XML uploaded anywhere?

No. The document is parsed in the page. The document is parsed in the page and never sent anywhere.

Does it validate the document?

No. It reformats what you give it. Checking against a schema is a different job, and one this deliberately does not pretend to do.

Will formatting change what the document means?

For most documents, no. But whitespace inside an element can be significant in XML — if yours relies on it, use the minifier rather than the formatter.

Something wrong with this tool, or an idea for it? Tell us