DEVELOPER TOOLS

XML Formatter & Validator

Format or compact XML and check whether it is well-formed. Processing stays in this browser; XML is not sent to a server.

Formatting uses 2 spaces and preserves an existing XML declaration.

Up to 200,000 characters. Comments and CDATA are retained.

Text-bearing and mixed-content elements are not reindented, to avoid changing their text.

Enter XML, then choose an action.

Using this XML tool

Format XML adds indentation only where an element has no direct text or CDATA nodes. It preserves mixed-content and whitespace-bearing child sequences as they are parsed. Minify adds no layout whitespace; existing whitespace-only text nodes are retained because their meaning cannot be inferred safely without a schema. Empty elements may be serialized with a self-closing tag.

Validation checks XML well-formedness in the browser; it does not validate against an XSD, DTD, schema, or application-specific rules. DTD and DOCTYPE declarations are rejected, and this tool does not fetch external resources. Browser parsing and serialization can normalize line endings, entity spelling, attribute formatting, and other lexical details while keeping parsed text and attribute values.

Review output before using it in another system. Browser XML parsers may report errors differently, and this tool is not a security sanitizer. XML escaping or sanitization must match the context where data will be used.