More from XMLBeautify
Guides
Frequently Asked Questions
Is my XML payload private?
Yes. Parsing, validation, and formatting happen in your browser, so SOAP and API payloads are never uploaded.
Can XMLBeautify minify XML?
Yes. Minification strips indentation and inter-element whitespace. Do not use it on formats where whitespace is significant — SVG text content and inline HTML inside XML can render differently once that whitespace is removed.
What does "not well-formed" actually mean?
The document fails basic XML syntax: an unclosed tag, a mismatched close tag, a bare & , or an invalid character. Well-formedness is not schema validity — a document can be well-formed and still violate its XSD.
🧭 Pro Tips & Gotchas
What it does
- Splits on the
><boundary and re-indents on open/close tags. It needs tags to be adjacent, so run it on markup that has no stray text between elements. - Output uses
\r\nline endings, which is deliberate for Windows editors but shows up as a whole-file diff in git if your repo is LF.
XML gotchas this tool cannot see
- CDATA sections (
<![CDATA[ ... ]]>) contain arbitrary text, including<and>. A tag-boundary splitter treats their contents as markup and will re-flow code samples and embedded HTML out of shape. - Comments and processing instructions (
<!-- -->,<?xml ... ?>) are not opaque either; a comment containing><is a real-world occurrence in hand-edited config files. - Self-closing tags (
<br/>) are fine, but HTML void elements written without the slash (<br>) leave the depth counter climbing forever. This is an XML tool — feed it XML, XHTML, or SOAP, not loose HTML. - Namespace prefixes are just text:
<soap:Envelope>and<Envelope>are different elements to a human parser and identical-looking to an indenter. Validate namespaces withxmllint --nooutorxmllint --schema. and other named HTML entities are not valid XML. Only the five predefined ones (& < > " ') exist; everything else needs a numeric reference or a DTD.- Whitespace is meaningful in XML in the places people least expect it:
<a> text </a>and<a>text</a>differ, so a reflow that inserts newlines inside text nodes changes the payload of a signed or hashed document.
For real work
xmllint --format (libxml2, everywhere), python -c "import lxml.etree", or xmlformatter (XMLStarlet). They parse properly, preserve CDATA and entities, and will tell you when the document is malformed instead of indenting nonsense.