About this tool
XML that's been minified, generated by a script, or pasted from a log file is often unreadable as one long unbroken line, making it hard to spot structural issues like an unclosed tag or mismatched nesting. This tool pretty-prints XML with consistent, readable indentation reflecting the actual element hierarchy, and validates the structure along the way, flagging malformed markup such as unclosed tags or invalid nesting rather than silently failing. It's useful for debugging API responses that return XML instead of JSON, reviewing configuration files, or simply making a dense XML document readable enough to actually review. Formatting and validation both run entirely in your browser.
Frequently asked questions
Does it validate XML syntax, not just format it?
Yes — malformed XML such as unclosed or mismatched tags is flagged as invalid rather than being silently reformatted around the error.
Does formatting change the actual XML data?
No, formatting only adjusts indentation and whitespace between elements; attribute values and element content remain exactly as provided.
Can it minify XML as well as pretty-print it?
Yes, in addition to pretty-printing, you can minify XML down to a single compact line for production use.
Does it support XML namespaces?
Yes, namespaced elements and attributes (e.g. xmlns:ns="...") are preserved and formatted correctly alongside regular elements.
What happens if my XML has a syntax error?
The tool reports that the document is invalid, helping you identify that there's a structural problem to fix, similar to how the JSON tool reports invalid JSON.