XML Formatter & Validator
Check XML 1.0 namespace syntax and format compact element containers while retaining text, references, comments and CDATA.
About this xml formatter & validator
XML Formatter & Validator — browser-based utility.
How this tool works
Checks XML 1.0 and Namespaces in XML 1.0 syntax, then adds two-space indentation to compact containers containing elements but no text or CDATA. Existing text, character references, attribute spelling, comments, processing instructions and CDATA are retained. Mixed content and xml:space="preserve" subtrees are kept together.
- Load the sample or paste an XML document.
- Choose Run locally.
- Check the nested elements and copy the complete result.
Worked example
Scenario: Load the sample or paste an XML document.
Sample input:
Processing: Checks XML 1.0 and Namespaces in XML 1.0 syntax, then adds two-space indentation to compact containers containing elements but no text or CDATA. Existing text, character references, attribute spelling, comments, processing instructions and CDATA are retained. Mixed content and xml:space="preserve" subtrees are kept together.
Illustrative output:
Limits and verification
Input: at most 1,000,000 UTF-16 code units. Output: at most 8,388,608. Nesting: at most 100 element levels. Only XML 1.0 without a DTD is supported; DOCTYPE declarations and unknown entities are rejected. This is a syntax check, not XSD or DTD validation, canonicalization, or byte-for-byte preservation. A leading BOM and whitespace outside the root may be replaced. Existing indentation inside elements is retained. Encoding declarations are retained as text; the tool does not encode a file. The visible workspace offers no file-upload or download control.
Examples demonstrate an expected workflow; they do not prove every input or every branch of an external specification. Check important results with an independent source before using them for money, security, compliance, safety, or irreversible file changes.
Browser processing boundary
Tool input is processed by code running in the browser and is not intentionally sent to a CZOA processing API. The page can still request ordinary site assets, analytics, or advertising when those services are enabled. Browser extensions and managed-device software remain outside this tool's control.
Relevant references
These references govern or help explain the format, protocol, or calculation used here. Listing a reference does not claim certification or complete implementation of every optional feature.
Content owner: CZOA Tools · Last reviewed: 2026-09-15 · Review methodology
How to use it
- Load the sample or paste an XML document.
- Choose Run locally.
- Check the nested elements and copy the complete result.
Frequently asked questions
What does XML Formatter do to a compact element with text and attributes?+
For `<root><item id="1">Ada</item></root>`, it writes root and item on indented lines while retaining the attribute and text: `<item id="1">Ada</item>`.
Does formatting validate an XSD or fetch external entities?+
No. The formatter checks XML grammar and formats lexical structure; it is not XSD validation, and it does not resolve an external entity as a network request.
Why are some XML nodes intentionally kept on one line?+
Text-only elements such as the recorded item example remain compact inside their opening and closing tags. The formatter adds structural indentation rather than rewriting text content.
What XML input boundary should I check before formatting?+
The page accepts nonempty, well-formed XML text within its size bound and valid XML characters. It preserves lexical spans where possible; a formatted document is not proof of schema or business-data validity.
