XML formatter
Runs entirely in your browser. Your files and data never leave your device.
About this tool
Paste an XML document and this tool pretty-prints it with proper indentation, or strips it down to a single compact line. It also checks that the document is well-formed and reports the line and column where a tag mismatch, unclosed attribute, or other syntax error breaks the structure.
How does it find the exact location of an error?
Before formatting anything, the tool runs the document through fast-xml-parser’s validator, which walks the XML and checks it against the structural rules of the format: every opening tag needs a matching closing tag, attributes need to be quoted, and so on. When something’s wrong, that validator reports exactly where it noticed the problem, and this tool surfaces that line and column directly instead of just saying “invalid XML.” That’s a lot faster than scanning a large file by eye for one missing /.
Once a document passes validation, formatting itself is handled by the xml-formatter library, which reindents nested elements at 2 spaces, 4 spaces, or tabs, whichever you pick. Minify mode uses the same library to strip the whitespace back out, collapsing everything to one line without changing the actual content. Both directions preserve the document as-is; this is a formatter, not an editor, so it won’t reorder attributes or rewrite tag names.
Does the XML I paste get sent to a server?
No. Formatting and validation happen entirely in your browser using those two JavaScript libraries running locally, so nothing you paste is uploaded anywhere. That matters for config files, SOAP payloads, or exported data that might contain real customer or business details.
What do people use this for?
Cleaning up a minified XML response from an API before reading it, checking a hand-edited config file for a stray unclosed tag before deploying, or reformatting an RSS feed or SVG file to a consistent indent width before committing it to version control. It also works well as a quick sanity check when an XML parser elsewhere in your stack throws a vague error and you just need to know which line to look at.