JSON Beautifier

XML Formatter — Format & Indent XML Online

Format well-formed XML with two-space indentation. Keep attributes and mixed text intact while making element-only structures easier to inspect.

Input XML
Output

Processed in your browser. Mixed text and xml:space=preserve subtrees are kept together. Formatting can add whitespace between elements.

Make the most of this tool

01

Paste one XML document with a single root. Invalid markup is reported before formatting.

02

Mixed text such as <p>Hello <b>world</b>!</p> stays together. Subtrees marked xml:space="preserve" are not reindented.

03

Formatting may add whitespace between elements. This checks well-formedness; it does not validate against an XSD or DTD.

Frequently Asked Questions

Does formatting change XML text?

Mixed-content elements and xml:space="preserve" subtrees are kept together. Indentation adds whitespace between other elements; check the result if your application treats that whitespace as significant.

Does it retain attributes and namespaces?

The browser XML parser and serializer retain attributes and namespace information. Malformed XML is rejected; formatting is not an XML Schema validation step.