XML Formatter

Indent element-only XML and retain mixed text or xml:space-preserved sections through browser serialization. Check syntax errors before copying.

Read XML structure while keeping an eye on text-sensitive sections. The formatter indents element-only nesting and serializes mixed-content and xml:space-preserved subtrees without inserting its own indentation inside them.

  • 100% free
  • No registration
  • On your device
  • Modern browser
  1. 1Enter details
  2. 2Adjust options
  3. 3View result
ResultLive

Your input stays on this device for this operation. We don’t upload or store it.

About XML Formatter

Read XML structure while keeping an eye on text-sensitive sections. The formatter indents element-only nesting and serializes mixed-content and xml:space-preserved subtrees without inserting its own indentation inside them.

Element indentation

Adds two spaces per level to element-only branches.

Mixed text handling

Serializes mixed-content branches without its own indentation.

How to use XML Formatter

  1. 1

    Paste the XML document

    Paste the XML in Source text.

  2. 2

    Check XML syntax

    Press Process and address any syntax message.

  3. 3

    Review mixed content

    Review text-sensitive sections and copy the formatted result.

Formats and practical limits

XML document text in, formatted XML text out.

  • DTD and entity declarations are rejected. The formatter caps recursive indentation at 100 levels and accepts up to 100,000 input units.
  • Browser serialization may change syntax such as empty tags. Added indentation can matter to downstream consumers of whitespace.

Practical example

Try <root><item>A</item><item>B</item></root> to see the item elements placed on separate lines.

Further reading

Frequently Asked Questions

2 answers
Does it validate against an XSD?

The browser parser checks XML syntax. Schema validation needs another workflow.

Will it indent text inside <p>Hello <b>world</b>!</p>?

It serializes that mixed-content element as a unit.