XML Sort

递归按标签名或属性名对同级子节点排序,输出格式化 XML。

What Is an XML Node Sorter?

An XML node sorter is an online tool that sorts child nodes in an XML document and outputs formatted XML. It recursively orders sibling elements by tag name or attribute name, which is handy for normalizing data structures, comparing two XML documents, or cleaning up messy XML. Sorting preserves text, comment, CDATA, and processing-instruction nodes in place and only reorders elements.

Main Features

  • Three sort modes: by tag name, by attribute name, or by tag then attribute
  • Recursively sorts sibling nodes at every level and generates formatted XML
  • Keeps text, comment, CDATA, and processing-instruction nodes in place
  • Output is auto-indented and can be copied with one click

Use Cases / Notes

Great for normalizing XML structures, organizing configuration files, or comparing data differences. Note that a valid XML document is required; whitespace-only text nodes are dropped, while an XML declaration such as <?xml version="1.0"?> is kept at the top automatically.

How to Use

  1. Paste the XML content into the input box
  2. Choose a sort mode (tag name / attribute name / tag then attribute)
  3. Click "Sort" and review or copy the formatted result