Compact input
<?xml version="1.0"?><catalog><book id="b1"><title>XML Basics</title><author>Ada</author></book><note>Read <em>carefully</em> today.</note></catalog>Paste, type, choose, or drop a local XML-family file. Press Ctrl/Cmd + Enter to format.
Output preserves original markup lexemes where possible. Always review whitespace-sensitive documents.
Element-only content is indented, while inline mixed content such as text around <em> remains unchanged.
<?xml version="1.0"?><catalog><book id="b1"><title>XML Basics</title><author>Ada</author></book><note>Read <em>carefully</em> today.</note></catalog><?xml version="1.0"?>
<catalog>
<book id="b1">
<title>XML Basics</title>
<author>Ada</author>
</book>
<note>Read <em>carefully</em> today.</note>
</catalog>This tool checks well-formedness: one root element, correct nesting and case, quoted attributes, valid namespace bindings, and legal XML syntax. Schema validation is a separate step that checks an already well-formed document against XSD, Relax NG, or application rules.
The formatter first requires valid XML, then works from the original lexical text. It inserts indentation only around element-only content. It does not use XMLSerializer, so it avoids unnecessarily rewriting prefixes, attribute spellings, CDATA sections, declarations, and DOCTYPE text.
XML can mix words and child elements, as in <p>Read <em>this</em> now.</p>. Adding line breaks there changes text. The formatter therefore preserves the original subtree when an element has direct non-whitespace text or inherits xml:space="preserve".
Unlike HTML, XML has no general rule that indentation is insignificant. This minifier removes whitespace-only nodes only in content that appears element-only, and optionally removes comments. That is useful for many feeds, configuration files, and data documents, but it is not a semantic guarantee.
Namespace prefixes are retained as written. CDATA is treated as text and preserved verbatim. Entity references remain lexically unchanged in output; the browser parser must still be able to resolve every entity for validation to succeed.
Use Ctrl/Cmd + Enter to format and Ctrl/Cmd + Shift + M to minify. The editor reports UTF-8 bytes, lines, characters, and the cursor location.
xml:space="preserve" regions.Explanatory content last reviewed: .
A well-formed document has one root element, properly nested and case-matched tags, quoted attribute values, legal names and characters, and correctly formed declarations, comments, CDATA sections, and entity references.
No. It checks XML well-formedness with the browser's XML parser. It does not validate document structure or data types against an XSD, Relax NG schema, or DTD grammar.
The formatter preserves existing text in mixed-content and xml:space="preserve" elements, but it replaces whitespace-only indentation in element-only content. Because an application can treat any whitespace node as data, review the result before production use.
It removes whitespace-only text between markup where the element has no direct text content and is not under xml:space="preserve". Comments are removed only when selected. It does not rename elements, rewrite attributes, or alter CDATA text.
Yes. Native parsing validates namespace usage, while the output process retains namespace prefixes, CDATA sections, processing instructions, XML declarations, and document type declarations as written.
Do not rely on browser XML parsers to fetch or resolve external DTDs or entities. For documents that depend on an external catalog or schema, use a controlled XML toolchain with explicit resource-resolution rules.
No. Formatting can add indentation, but it cannot recover removed comments or the author's original whitespace. Keep the original XML in version control or another safe location.
No. This tool processes editor contents in the current browser tab, does not upload them, and does not save them to local storage. Choosing a file reads it locally.
The tool accepts up to 5 MiB for an interactive browser session and warns above 1 MiB. Browser memory and speed vary, so a streaming desktop or command-line parser is better for very large documents.