Skip to content

XML Formatter

Beautify and indent XML while keeping comments, CDATA sections, attributes and element order exactly as written.

Runs in your browserXML → XML
Loading tool…

Example

Input
<note><to>Ada</to><!-- greeting --><body lang="en">Hello</body></note>
Output
<note>
  <to>Ada</to>
  <!-- greeting -->
  <body lang="en">Hello</body>
</note>

How to use the XML Formatter

  1. Paste or type your XML into the input area, or open a file from your device.
  2. Adjust the options above the editor if the tool offers any.
  3. Review the XML result, then copy it or download it as a file.

Privacy and limitations

  • Your data is processed on your device and is not uploaded to any server.
  • Whitespace-sensitive content (xml:space="preserve") is re-indented like any other content.

Frequently asked questions

Will formatting change my XML data?

Only whitespace between elements changes. Comments, CDATA, attributes and element order are kept. Leading and trailing spaces inside text-only elements are trimmed.

Browse all xml converters →