XML Formatter & Validator

Paste XML to indent it by depth and see right away whether it is well-formed.

Your text and files never leave your browser — nothing is sent to a server.

How to use

  1. Paste XML into the input box. Each element goes on its own line, indented to match its depth.
  2. Choose 2 spaces, 4 spaces or a tab under “Indent”, or pick “Minify” to remove the whitespace between tags.
  3. Turn off “Keep comments” to drop every <!-- --> comment.
  4. If a tag is not closed properly or an attribute quote is missing, the output marks the spot and the status line shows the line and column.
  5. When the XML is well-formed, the line under the result shows ✓ with element and attribute counts. Undeclared namespace prefixes (such as soap:) are still formatted but flagged with ⚠.

FAQ

Will it change my text content?

Only the blank whitespace between tags is rearranged. Elements that mix text and tags, such as <p>Hello <b>world</b></p>, are kept exactly as written on one line because their spaces may matter. Attribute values and entity references like &amp; are not touched.

Does it validate against an XSD or DTD?

No. It checks XML syntax (well-formedness) only, such as matching tags and quoted attributes. To test conformance to a specific schema, use a validator such as xmllint; to draft a schema from sample XML, try the XSD Generator.

What does “well-formed” mean?

Every opening tag has a matching closing tag, there is exactly one root element, attribute values are quoted, and & and < are escaped properly. Any XML parser stops when one of these rules is broken.

Is my XML uploaded anywhere?

No. Formatting happens entirely in your browser and nothing is sent to a server.

Related tools

All tools