Indent
Mode
XML
Result
Results appear as you typeShortcut: Ctrl + Enter to run

How to use the XML Formatter

  1. Paste XML on the left, or press "Sample" to load a sitemap.
  2. Choose the indentation and mode (Pretty or Minify).
  3. The result appears instantly; if the XML is malformed, the status bar shows the line and column.
  4. Press "Copy" or "Download" to save it as .xml.

Examples

Pretty-print one-line XML

Input
<note><to>Tove</to><from>Jani</from><body>Hi!</body></note>
Output
<note>
  <to>Tove</to>
  <from>Jani</from>
  <body>Hi!</body>
</note>

Specs & key facts

CheckXML 1.0 well-formedness
PreservedAttributes, comments, CDATA, processing instructions and the XML declaration
Indentation2 spaces, 4 spaces, Tab, or minified
Not includedDTD / XSD schema validation
ProcessingIn your browser (nothing is uploaded)
PriceFree, 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.