XML Formatter & Validator
Pretty-print, minify and validate XML with exact error positions
About this tool
This tool pretty-prints XML with your choice of indentation, flags well-formedness errors with the exact line and column, and can minify a document to a single line. Comments, CDATA sections and the XML prolog survive formatting — a surprising number of formatters silently eat them.
Validation here means well-formedness: properly nested tags, quoted attributes, legal characters. That catches the overwhelming majority of hand-editing accidents — a missing slash, an unclosed element, a stray ampersand. Schema validation against an XSD is deliberately out of scope; that belongs in your build pipeline with the schema file present.
Config files, SOAP payloads, RSS feeds and Android manifests routinely contain internal hostnames and keys. Everything here parses locally — nothing is transmitted.
Frequently asked questions
- Why does my XML fail with "char … is not expected"?
- The usual suspects are a raw & that should be &, an unquoted attribute value, or tags that close in the wrong order. The error message carries the line and column of the first offending character, and the input box marks it.
- Does the formatter reorder or normalize my document?
- No. Elements, attributes and their order are preserved exactly; only inter-element whitespace changes. Text content that shares a line with markup is trimmed and internal runs of whitespace collapse — if you rely on significant whitespace (xml:space="preserve"), keep those sections minified.
- What does minify remove?
- Indentation and line breaks between elements, plus comments. CDATA sections, processing instructions and the prolog stay. The result parses identically for any consumer that does not depend on whitespace-only text nodes.
- Can it validate against an XSD or DTD?
- No — this checks well-formedness only. Schema validation needs the schema file and an XSD engine, which is better done in your toolchain (xmllint --schema, or your language's XML library).