XML Formatter & Validator
Pretty-print or minify XML and get the exact line of any error.
How to use XML Formatter & Validator
- Paste XML or open a file (.xml, .svg, .rss and similar).
- Choose the indentation, or tick Minify.
- Copy or download the result. If the XML is broken, the message names the problem and its line.
How it works
The formatter checks that the document is well-formed before printing it: every tag closed and correctly nested, exactly one root element, attribute values quoted and not repeated, and & written as an entity. When something is wrong you get a plain-language message with the line and column, including where the unclosed tag was opened.
Formatting changes whitespace only. Elements that contain just text stay on one line (<title>Midnight Rain</title>), comments, CDATA sections, processing instructions and the DOCTYPE are kept exactly, and attribute order and quoting are untouched. Minify removes the whitespace between tags.
Everything runs in your browser. The text you paste is not uploaded, logged or saved, so configuration files, API responses and customer data stay on your device. "Valid" here means well-formed; checking against a schema (XSD or DTD) is not performed.
Example
<a><b>1</b><c/></a> becomes three indented lines; <a><b></a> reports “Closing tag </a> does not match the open <b> from line 1”.
Frequently asked questions
What is the difference between well-formed and valid XML?
Well-formed XML follows the syntax rules: tags closed and nested, one root, quoted attributes. Valid XML additionally matches a schema (XSD or DTD) that says which elements are allowed. This tool checks well-formedness.
Does formatting change my data?
Only whitespace between tags. Be aware that in mixed content (text and tags interleaved, as in XHTML paragraphs) whitespace can be meaningful.
Can I format SVG, RSS or sitemap files?
Yes. They are XML.
Is my XML sent to a server?
No. Parsing and formatting happen in your browser.
Limitations
- Checks well-formedness, not validity against an XSD or DTD.
- Whitespace inside mixed content is normalised, which can matter for document-style XML.
- Very large files (tens of megabytes) may be slow.
Last reviewed November 9, 2026. How we build and test tools.