XML Formatter & Validator
Format or minify XML and check that it is well formed, with the error explained.
Loading…
Runs entirely in your browser. Nothing you enter is uploaded or stored on a server.
About this tool
XML is strict where HTML is forgiving: one unclosed tag or unescaped character invalidates the whole file, and the system that rejected it usually tells you very little. This tool formats and minifies, and more usefully tells you straight away whether the document is well formed, what its root element is and how many elements it holds — and when it is not, why it was rejected in readable terms.
How to use
- 1Paste your XML into the input box.
- 2Choose Format to tidy it or Minify to compress it.
- 3Read the status bar below: well formed with its root element, or the reason it failed.
- 4Copy the result.
When you need it
- Checking an e-invoice file or an API response before sending it.
- Tidying XML that arrived on a single line.
- Finding out why a system rejected an XML file.
- Minifying XML before putting it in a request.
Frequently asked questions
What does "well formed" mean?
The file follows XML rules: every open tag is closed, nesting is correct, special characters are escaped and there is exactly one root element. It does not mean the file matches a particular schema — XSD validation is a separate question.
Why is my file rejected when it looks fine?
The usual causes are an unescaped & (it must be &), more than one root element, whitespace before the <?xml declaration, or tags closed in the wrong order. The message below the tool says which.
Does it handle large XML?
Yes, as long as it fits in browser memory. Everything is processed locally so no server imposes a size limit, though very large files may slow the tab.
Related tools
- JSON Formatter & ValidatorFormat, minify and validate JSON. Errors point to the exact position.
- HTML Viewer & FormatterPreview HTML safely, format or minify it, and read its element tree.
- Unix Timestamp ConverterConvert Unix timestamps to dates and back, with ISO, local, Hijri and relative time.
- Number Base ConverterConvert between binary, octal, decimal, hex and any base up to 36. Handles very large numbers.
- Color Converter & Contrast CheckerConvert HEX, RGB and HSL, and check WCAG contrast against white and black.
- Base64 Encoder / DecoderConvert text to Base64 and back. Handles Arabic and any Unicode text correctly.