← All tools

XML formatter

Indent XML while preserving declarations, comments and mixed content.

Your input stays in this browser.

Your result

Tree view

Preserve text inside the tags

The formatter parses XML and reports malformed input. Conservative whitespace handling preserves mixed content, where adding spaces could change text between elements. The tree view shows element names and nesting.

A worked example

<p>ink <b>blue</b> water</p> keeps the spaces around the bold word. An unmatched closing tag is rejected. To display an XML example in HTML as text, escape its angle brackets and ampersands.

Before you use the result

No XSD validation, XPath evaluation or external document loading is provided. Document type and entity declarations are rejected. Formatting does not prove an XML document meets a business schema.

Formatting rules and what is preserved