XML formatter and validator
XML formatter that indents minified or messy XML with 2 spaces and shows the line and column of any error. Runs in your browser, nothing is uploaded.
How to format XML
Paste XML into the input pane and click Convert. The tool checks that it is well-formed, then puts each element on its own line, indented by two spaces for every level of nesting. Copy the result or download it as an .xml file. It works for config files, SOAP responses, RSS and Atom feeds, sitemaps, SVG and Office XML parts.
Validation and error messages
Before formatting, the XML is checked for well-formedness: matching start and end tags, quoted attribute values, a single root element and no repeated attributes. If something is wrong, you get the line and column of the first problem and a short description, so you can go straight to the fix. The check doesn't validate against a DTD or XML Schema.
What the formatter changes
Only the whitespace between tags. Elements that hold other elements are broken onto separate lines and indented. An element that contains text, CDATA or mixed content, such as a paragraph with a bold word inside it, is kept exactly as written, because spaces and line breaks there can be part of the data. The same goes for elements marked xml:space="preserve". Attributes, comments, entities, processing instructions and the DOCTYPE are left untouched.
Stays in your browser
The XML is checked and formatted by code running in this tab. Nothing is uploaded, so API responses, invoices and config files with credentials stay on your device.
Before you start
Input: XML. Output: Formatted XML. The settings appear before anything runs, so you can check them first. Your original file is never changed.
The value you enter is processed in your browser. Still test the output where it will be used. Clean formatting does not prove the data is safe or correct.
Keep the original until you have opened and checked the result. The work happens in this browser tab, so the size you can handle depends on your device's memory, your browser and the file itself.
How to use the XML formatter and validator
- Paste or type your XML into the input pane.
- Click Convert to validate and format it.
- If there's an error, go to the line and column shown and fix it.
- Copy the result or download it as an .xml file.
Last updated · How we build and check tools · Report an error