About the XML Formatter
XML from feeds, sitemaps, SOAP APIs and config files is often unreadable on one line. The XML Formatter indents it properly and checks it for well-formedness errors.
Choose the indentation, minify for production and copy the result.
How to use the XML Formatter
- Paste your XML.
- Click format or minify.
- Fix any reported errors.
- Copy or download the output.
Key features
- Pretty printing
- Well-formedness validation
- Minification
- Custom indentation
Well-formed XML explained
Well-formed XML follows the basic grammar rules: every opening tag has a matching closing tag, tags are nested properly without overlapping, attribute values are quoted, there is exactly one root element and special characters such as & and < are escaped. Any break in these rules stops parsers from reading the file, so the formatter reports the error instead of formatting broken data.
Being well-formed is different from being valid. Validation checks the content against a schema (XSD or DTD) that defines which elements are allowed. This tool checks well-formedness, which catches the vast majority of everyday problems.
Common uses
- Reading and debugging sitemap.xml and RSS feeds.
- Inspecting SOAP API requests and responses.
- Tidying configuration files such as Maven pom.xml or Android layouts.
- Minifying XML before sending it over the network.
Tips for the best results
- Escape ampersands in text as & to avoid the most common XML error.
- Use 2-space indentation for deeply nested files to keep lines short.
- Minify only copies used in production; keep a formatted version for editing.
- Format a sitemap before submitting it to Search Console to spot missing closing tags or broken URLs quickly.
Frequently asked questions
Does it validate against a schema?
It checks that XML is well-formed, but it does not validate against an XSD schema.
Can I format sitemap.xml files?
Yes, any XML file can be formatted.
Is my XML uploaded?
No, it stays in your browser.
Can it convert XML to JSON?
This tool formats and checks XML. To go from JSON to XML, use the JSON to XML Converter.
Is my XML uploaded?
No. Formatting and validation run in your browser using its built-in XML parser.
Does it keep comments?
Yes. XML comments are kept when formatting.