Skip to content
ZeroServer.tools

XML Sorter

Recursively sort sibling elements and attributes alphabetically, then re-serialize the document.

Drop an .xml file or click to browseAll processing stays local in your browser.
Sorted Output

How XML sorting works

This tool parses your XML into a tree using a lightweight parser written from scratch (no browser DOM APIs), then walks the tree recursively: at every element, consecutive runs of sibling elements are reordered alphabetically by tag name, and each element's attributes are sorted alphabetically by attribute name. Text content, comments, and CDATA sections are left exactly where they are relative to the elements around them, so mixed content is never scrambled — only same-level element runs get reordered.

Sorting is useful for diffing two XML files that differ only in element order, normalizing config files or RSS/Atom feeds for version control, or making generated XML deterministic and easier to review. Toggle attribute sorting off if you only want elements reordered, and toggle case-sensitive sorting on if you need strict ASCII ordering (uppercase before lowercase) instead of natural alphabetical order. Everything runs locally in your browser — nothing is ever uploaded.

Private & free — this tool runs entirely in your browser.

Recommended: IndieKit Ship your Next.js startup in days.affiliate

Related Formatters & Validators tools