XML Formatter and Tree Viewer

Paste XML, pretty-print it, inspect a collapsible element tree, then copy or export the formatted document.

Formatted XML
Viewer mode
An XML tree and formatted text view will appear here.

What it does

XML payloads often arrive as one long line or as deeply nested documents where attributes, text nodes, and repeated elements are hard to scan. Pretty-printing plus a collapsible tree makes the document shape visible again.

This tool uses the xml-formatter package for XML pretty-printing, then renders a browser-side tree from the parsed document so attributes, elements, comments, and text are easy to inspect.

Common uses

  • Paste XML from SOAP responses, SAML assertions, RSS feeds, SVG-like markup, config files, or integration logs.
  • Use the tree view to collapse noisy branches and focus on the element you are debugging.
  • Use the text view to copy the complete formatted XML or export it as a .xml file.

Watch outs

  • XML must have a single root element. Multiple top-level elements are not a valid XML document.
  • Mismatched tags, missing closing tags, and invalid nesting will stop formatting until fixed.
  • The tree view trims whitespace-only text nodes so the structural outline stays readable.

Privacy

XML is parsed, formatted, copied, and exported in your browser. The pasted document is not uploaded.

FAQ

Can I copy the entire formatted XML as plain text?

Yes. The Copy button copies the full pretty-printed XML document, not just the tree view.

Can this format XML fragments with multiple roots?

No. XML documents require one root element, so multiple top-level nodes must be wrapped before formatting.

Which package handles the XML formatting?

The formatter uses xml-formatter, a browser-capable XML pretty-printer that respects XML spacing options.

Related tools