XML Formatter & Validator
Beautify, minify, and validate XML. Everything runs in your browser, so your data never leaves the page.
About this XML formatter
This is a free online XML formatter and validator. Paste any XML document into the input panel and you'll get a tidy, syntax-checked version in the output panel. If the input is malformed, the tool points at the line and column where the parser failed.
Features
- Format any XML with 2 spaces, 4 spaces, or tab indentation.
- Minify XML to remove formatting whitespace for transport.
- Validate well-formedness with line and column error reporting.
- Preserve comments, CDATA sections, processing instructions, and the XML declaration.
- Copy the result or download it as a
.xmlfile.
How it works
Parsing uses your browser's native DOMParser, the same XML parser that powers web platform APIs. The tool walks the resulting DOM tree and re-emits it with your chosen indentation. Mixed content (text and elements together, like in HTML-flavored XML) is kept on one line so significant spacing is not lost.
Privacy
Your XML never leaves your browser. The whole tool runs locally as JavaScript on this page, so you can safely paste sensitive configuration, SOAP envelopes, manifests, or feeds without anything being uploaded.
Frequently asked questions
Does this tool send my XML anywhere?
DOMParser. Nothing is sent to a server.Does it validate against an XSD, DTD, or RelaxNG schema?
xmllint or an IDE plugin.Are XML namespaces handled correctly?
xmlns declarations are preserved on the elements where they appear, and re-emitted as written.