Paste or load XML, validate it with the browser parser, and get clean output with 2- or 4-space indent, CDATA kept and elements self-closed.
Parsing and formatting happen locally in your browser. Your XML never leaves your device.
Pasting XML and pressing Format runs the browser's built-in DOMParser — the same synchronous parser the platform uses — over your text. If the result contains a parsererror node, the message and its line/column hint are surfaced instead of output. On success a recursive serializer walks the tree and rebuilds the document with your chosen indent, one element per line.
<row></row> becomes <row/>.XML has a short list of strict rules and browsers reject the whole document when one is broken. The usual culprits: more than one root element, a tag closed with the wrong name or never closed, an unescaped & or < in text, mismatched case between opening and closing tags, or a stray character before the XML declaration. The error line points at the reported position so you can jump straight to the problem.
Both ways carry text that would otherwise break XML. Escaping replaces special characters with entities (& for &, < for <), while a CDATA section <![CDATA[ ... ]]> marks everything inside as raw text. This formatter preserves CDATA blocks verbatim — it does not convert them into escaped text or the other way around.
No. Namespace prefixes (like <soap:Envelope>) are preserved exactly as written — attributes, element names and all. The formatter only re-indents; it neither expands prefixes into URIs nor validates that a prefix is declared, so a namespace typo that parses will still print.
Re-indenting adds whitespace between elements, which matters only if your parser treats whitespace inside elements as data (rare, mostly in schema-validated or mixed-content documents). Attribute order, entity handling and CDATA blocks are kept as-is, and an empty element prints as <tag/> exactly as XML defines it.
No. Parsing and pretty-printing happen with the browser's built-in DOMParser and plain JavaScript. Your XML never leaves your device, and there is no network request attached to formatting.
If you just finished with XML Formatter, the natural next steps are XML to JSON, Markdown to HTML, Markdown Live Editor, or browse every tool in Privacy File Tools.