XML Formatter & Validator
Paste XML to check that it is well-formed and re-indent it for reading, or minify it for transport. Parsing uses your browser's own XML parser, so the document never leaves this page.
How to use
- Paste your XML into the input box, or click Load sample to try it.
- Choose the indentation (2 spaces, 4 spaces or tabs).
- Click Format to validate and pretty-print, or Minify to strip the whitespace between tags.
- If the XML is not well-formed, the status line shows the parser's message and line number — fix it and run again.
- Copy the result or download it as an .xml file.
Examples
<note><to>Ada</to><from>Charles</from><body>Engine ready</body></note>
<note> <to>Ada</to> <from>Charles</from> <body>Engine ready</body> </note>
Supported formats
- Any well-formed XML 1.0 document: sitemaps, RSS/Atom feeds, SOAP envelopes, SVG, Maven POM files, Android layouts and so on.
- Preserves the XML declaration, DOCTYPE, comments, CDATA sections, processing instructions and namespace prefixes.
Privacy
This tool runs entirely in your browser. Nothing you enter or open is sent anywhere. Privacy policy.
Limitations
- This checks well-formedness only. It does not validate against a DTD or XML Schema (XSD).
- Elements that contain both text and child elements (mixed content) are kept on one line so no whitespace is added to the text.
- Very large documents (tens of megabytes) may be slow, because the whole file is parsed in memory.
FAQ
What does well-formed XML mean?
It follows XML's syntax rules: one root element, every opening tag closed in the right order, attribute values quoted, and special characters such as & escaped. A document can be well-formed but still invalid against a schema.
Is my XML uploaded anywhere?
No. The tool uses the DOMParser built into your browser, so the XML is parsed and re-serialised on your device without any network request.
Why did formatting change ' into an apostrophe?
After parsing, entity references in text become the characters they stand for. The formatter escapes only what XML requires (&, < and > in text, plus quotes in attributes), so the output is equivalent XML.