Beautify or minify XML with your own indent, and read every well-formedness fault by line and column before the document is reformatted.
Two XML files can carry identical data and share not one line. One came back minified from a SOAP endpoint; the other was hand-indented at four spaces by whoever last opened it in an editor. XML Formatter & Validator throws away both layouts and rebuilds the document from its parse tree, so indentation, attribute order and empty-tag style come out of your settings rather than out of the file's history.
Nothing gets reformatted until it parses. A hand-written tokenizer walks the source and reports every well-formedness fault it finds against a line and a column: a closing tag that does not match its opener, an attribute name repeated on one element, a bare ampersand, a second root element. Faults are collected together wherever recovering from one is safe, which means four typos come back in a single list instead of costing you four round trips.
Namespaced names such as dc:title stay whole. The XML declaration, comments, processing instructions and CDATA sections all reach the output intact, and the parser never reads inside a CDATA block, so an & parked in there is left alone while a bare one in ordinary text is flagged. Nothing is uploaded. The tokenizer is a few hundred lines of JavaScript running in the tab that loaded this page.
Press Load Sample and a single unbroken line arrives, opening <?xml version="1.0" encoding="UTF-8"?><catalog xmlns:dc="http://purl.org/dc/elements/1.1/" updated="2026-03-14">. It holds one book, bk-0472, priced at 24.50 GBP. Beautify at two spaces opens it into 15 lines and 541 bytes, and the banner reads 481 B → 541 B (+12.5%). The stat row settles on 10 elements, 5 attributes and a maximum depth of 4.
Two details in that output are deliberate. <in-stock/> stays self-closing instead of expanding into a pair, and the CDATA block inside <blurb> rides on the same line as its tags, because an element whose only child is text or CDATA is never split across lines. Switch to Minify with Strip comments ticked and the same record returns at 438 bytes, 8.9% under what you pasted.
.editorconfig asks for them, since spaces would show up as a diff on every line.<tag></tag> as <tag/>. Turn it off when the consumer is an older parser that treats the two forms differently.<!-- --> block. The XML declaration and any processing instructions are left where they are, because dropping those changes how the document is read.formatted.xml, or formatted.min.xml when you are in minify mode, straight from a Blob.tag at 2./catalog/book/tags/tag lands on your clipboard ready to paste into an XPath query or a test assertion. Almost nobody finds this on a first visit.Line 3, column 20: closing tag </titel> does not match <title>, which was opened at line 3, column 3. Knowing where the opener was is usually what tells you which of the two is misspelled.a bare & must be written &. XML predefines only < > & " and '. and it points at the ampersand itself, not at the end of the element.<p>Some <b>bold</b> text</p> comes back across four lines with the text nodes trimmed, so the single spaces either side of <b> are gone. For prose-bearing XML, minify instead: it drops whitespace-only nodes and leaves every other text node byte for byte.Paste an XML document above, or press Load Sample for a minified catalogue record with a namespace, a comment, a CDATA block and a self-closing tag in it. Nothing is uploaded; the parser runs in this tab.