📝 Text & List

XML Formatter

Format, indent and pretty-print XML. Validate well-formedness. Free. Runs in your browser — no sign-up, nothing uploaded.

XML Formatter

How to use the XML Formatter

1

XML well-formedness

Well-formed XML requires: one root element, all tags balanced and properly nested, case-sensitive matching of opening and closing tags, all attribute values in quotes, special characters escaped (&, <, >). This tool checks well-formedness and reports the first error if any.

2

XML vs HTML formatting

XML and HTML formatting look similar, but XML is strict. Every opening tag must have a matching closing tag (<br/> not <br>), and tags are case-sensitive (<Title> ≠ <title>). The browser's DOMParser handles both — this tool uses its "text/xml" mode for strict validation.

Frequently asked questions

What does formatting XML do?

It adds consistent indentation and line breaks so nested elements are easy to read. The data and element structure do not change.

What makes XML well-formed?

Every opening tag needs a matching closing tag, elements must nest correctly, attribute values must be quoted and there must be a single root element.

Does the tool validate against a schema?

It checks that the XML is well-formed. Validation against an XSD or DTD requires a schema-aware validator.