How to use the XML Formatter
- Paste XML on the left, or press "Sample" to load a sitemap.
- Choose the indentation and mode (Pretty or Minify).
- The result appears instantly; if the XML is malformed, the status bar shows the line and column.
- Press "Copy" or "Download" to save it as .xml.
Examples
Pretty-print one-line XML
<note><to>Tove</to><from>Jani</from><body>Hi!</body></note>
<note>
<to>Tove</to>
<from>Jani</from>
<body>Hi!</body>
</note>
Specs & key facts
| Check | XML 1.0 well-formedness |
|---|---|
| Preserved | Attributes, comments, CDATA, processing instructions and the XML declaration |
| Indentation | 2 spaces, 4 spaces, Tab, or minified |
| Not included | DTD / XSD schema validation |
| Processing | In your browser (nothing is uploaded) |
| Price | Free, no sign-up |
FAQ
What is the difference between well-formed and valid XML?
Well-formed means tags are closed, properly nested and escaped. Valid also means it matches a DTD or XSD schema. This tool checks well-formedness.
Does formatting change my XML content?
Only whitespace between tags. Leading and trailing whitespace in text nodes is trimmed, so if your data depends on it (for example xml:space="preserve"), check with Minify mode.
Can I use it for sitemap.xml or SVG?
Yes. Sitemaps, RSS, Atom and SVG are all XML and can be formatted and checked here.
Does it work with HTML?
Only XHTML that follows XML rules. Regular HTML allows unclosed tags such as <br>, which are reported as errors.