Skip to content
DevToolPilot

Text & Code

XML Formatter & Validator

Check that XML is well-formed, format it with indentation, and keep entity declarations from being expanded.

Processed locally. Nothing from the editor is stored.

How to use XML Formatter

The formatter checks well-formedness and reprints the document with indentation. It is not an XSD or DTD validator. DOCTYPE and ENTITY declarations are rejected so an external entity is not loaded.

  1. Paste XML or upload a file.
  2. Choose 2 spaces, 4 spaces, or a tab, then Format.
  3. Fix the reported line and column if the document is not well-formed, then copy or download the formatted result.

Examples

Indent a one-line payload

<root><item id="1">Hello</item></root> gains a line break and indentation while the attribute and text stay intact.

Stop a DOCTYPE

A document that declares an entity is rejected with an explanation instead of being expanded.

Questions

Does valid here mean valid against a schema?

No. It means the XML is well-formed: tags nest and close, and the parser can read the document.

Are comments kept?

Comments and CDATA are passed through the parser's preserve-order builder. If a construct cannot be represented safely, formatting fails with the parser error.

Related tools