XML Formatter

Indent or compact well-formed XML while preserving meaningful text whitespace.

Paste or choose an input, select options and process it locally. Review the result before copying or downloading.

Options

Up to 1 MB of UTF-8 input, 100 nesting levels and 50,000 nodes. DTDs, entity declarations and external references are rejected. This checks well-formedness, not XSD validity. Attribute quote style and namespace serialization may change; XML signatures must not be reformatted.

How to use

What does this tool do?

Indent well-formed XML or remove indentation between element-only children. Mixed text content and xml:space="preserve" regions keep their internal whitespace.

XML Formatter

Indent well-formed XML or remove indentation between element-only children. Mixed text content and xml:space="preserve" regions keep their internal whitespace.

Step by step

  1. Paste or choose an input, select options and process it locally. Review the result before copying or downloading.
  2. Format adds 2 or 4 spaces per level; compact removes inter-element formatting where safe. This is a syntax check, not XSD validation; signed XML may no longer verify after serialization.

Choosing the settings

OptionWhat changes
OptionsFormat adds 2 or 4 spaces per level; compact removes inter-element formatting where safe. This is a syntax check, not XSD validation; signed XML may no longer verify after serialization.
LimitsUp to 1 MB of UTF-8 input, 100 nesting levels and 50,000 nodes. DTDs, entity declarations and external references are rejected. This checks well-formedness, not XSD validity. Attribute quote style and namespace serialization may change; XML signatures must not be reformatted.

Example and expected result

A root containing 2 item elements becomes 4 formatted lines with 2-space indentation. The Tea and Coffee text stays unchanged.

If it is not working

  • Close mismatched tags and quote attribute values. DTDs, entity declarations and external stylesheet instructions are rejected; keep within 100 levels and 50,000 nodes.

Formats and limits

Up to 1 MB of UTF-8 input, 100 nesting levels and 50,000 nodes. DTDs, entity declarations and external references are rejected. This checks well-formedness, not XSD validity. Attribute quote style and namespace serialization may change; XML signatures must not be reformatted.

FAQ

What does this tool do?

Indent well-formed XML or remove indentation between element-only children. Mixed text content and xml:space="preserve" regions keep their internal whitespace.

Which setting should I choose?

Format adds 2 or 4 spaces per level; compact removes inter-element formatting where safe. This is a syntax check, not XSD validation; signed XML may no longer verify after serialization.

What are the limits?

Up to 1 MB of UTF-8 input, 100 nesting levels and 50,000 nodes. DTDs, entity declarations and external references are rejected. This checks well-formedness, not XSD validity. Attribute quote style and namespace serialization may change; XML signatures must not be reformatted.

Why did processing fail?

Close mismatched tags and quote attribute values. DTDs, entity declarations and external stylesheet instructions are rejected; keep within 100 levels and 50,000 nodes.

Is my input uploaded or saved?

No. Processing runs on your device. Inputs and results stay in this page’s memory until you clear it or leave. They are not uploaded, logged or stored by ToolRobin. Copying places the result on your device’s clipboard.