XML Formatter
Format, minify, or validate XML with clear syntax-error messages
Formats, minifies, or validates XML — pick a mode and the result updates as you type, using your browser's built-in XML parser to catch real syntax errors.
How it works
All three modes parse your input with the browser's native DOMParser. Format rebuilds the document with two-space indentation by walking the parsed tree by hand (browsers don't include an XML pretty-printer); minify strips whitespace-only text nodes and re-serializes; validate just reports whether parsing succeeded, quoting the browser's specific error location when one is given.
Frequently asked questions
How accurate are the error messages?
As accurate as the browser's own XML parser makes them — this tool extracts the line/column detail Chrome includes in its parser error output when available, rather than writing its own error-detection logic, so error quality follows the browser you're using.
What's the difference between Validate and Format?
Validate just tells you whether the XML is well-formed, with no output box. Format does the same parsing check but also shows a re-indented, readable version if it's valid.
Does formatting or minifying change my actual data, like attribute order?
Attribute order and element structure are preserved as parsed; only whitespace and indentation change between the three modes. Minify specifically removes whitespace-only text nodes between elements, not attribute or element content itself.
Can it fix invalid XML for me?
No — it can only report that XML isn't well-formed and where the parser stopped; it doesn't guess at your intent or auto-repair mistakes like an unclosed tag.
Is my XML sent anywhere?
No — parsing, formatting, and validation all happen locally in your browser using the built-in DOMParser. Nothing is uploaded.