Compact catalog
<catalog><item id="a1"><name>Pen</name></item></catalog> gains readable line breaks in indentation mode.
Inspect an XML payload before you edit or share it. This formatter reports malformed markup, counts elements and attributes, and adds indentation to compact element-only sections without stripping existing text.
182 / 500,000 characters. Processing stays in this browser.
Text, mixed content, existing whitespace, CDATA, comments, and xml:space="preserve" stay intact. Indenting compact element-only content adds whitespace text nodes; choose preserve mode if every character matters.
Supports XML 1.0, ASCII element/attribute names, and declared namespace prefixes. DTDs, custom entities, external references, XML 1.1, and non-UTF-8 declarations are rejected. Limits: 64 levels, 50,000 nodes, 1,000 attributes per element.
All parsing and exports run locally in your browser. Example records are original fictional data, not an external dataset.
Paste XML or open a UTF-8 text file.
Choose two-space, four-space, or preserve-spacing mode, then validate.
Review the structure counts and copy or download the normalized XML.
<catalog><item id="a1"><name>Pen</name></item></catalog> gains readable line breaks in indentation mode.
<p>Hello <b>world</b>!</p> stays inline so the spaces around world keep their meaning.
XML text can be meaningful even when it looks like layout spacing. The formatter preserves existing text nodes, including whitespace-only nodes. It inserts indentation only where every direct child is an element, comment, or processing instruction. An inherited xml:space="preserve" prevents insertion. Preserve-spacing mode is best for documents whose text nodes are compared exactly.
Attributes use double quotes, empty elements use self-closing tags, and parsed character references are escaped as needed. XML line endings are normalized. Formatting is not canonical XML and must not be used to prepare a digital signature.
One root element is required. ASCII names, quoted attributes, namespaces, comments, CDATA, and processing instructions are supported. DTDs and custom entities are refused during tokenization. No referenced resource is fetched. Unicode element names and non-UTF-8 encoding declarations fall outside this tool’s supported subset.
Existing whitespace is retained intentionally. Replacing it could change document text. The indentation option primarily expands compact element-only markup.
No. It checks supported XML syntax and namespace declarations, not a business schema. DTD declarations are rejected.
Escape literal ampersands as &. The five predefined entities and valid decimal or hexadecimal character references are supported.