XML Formatter
Use your browser’s XML parser to check a document and add readable indentation. Subtrees containing text or CDATA are left untouched to protect meaningful whitespace. Parsed XML is never inserted into the live page or executed; output is plain text.
Key features
- Report malformed XML instead of generating a misleading result.
- Indent text-free element regions using two or four spaces.
- Preserve comments, processing instructions, CDATA, and xml:space="preserve" regions.
- Reject DTD and entity declarations before parsing.
How to use
- Enter an XML document with one root element.
- Choose indentation or structural reserialization, and select an indent width.
- Run, inspect, and copy the output. Keep the original file separately.
Use cases
- Inspect nested XML API responses.
- Find mismatched tags in configuration files.
- Review mixed text-and-tag documents without stripping content whitespace.
Frequently asked questions
Why are some elements not reindented?
Text nodes, including whitespace-only text, can carry meaning. A subtree containing text or CDATA is left unchanged, so existing line breaks are not forcibly reformatted.
Is reserialization the same as minification?
No. Reserialization outputs the parsed DOM as XML but does not remove text whitespace. This avoids deleting spaces between inline elements in mixed content.
Does it validate DTDs or XSD schemas?
DTD and ENTITY declarations are rejected, and XSD validation is not performed. Checks are limited to the XML syntax and structure handled by the browser parser.
Will the output be byte-for-byte identical?
No. Parsing may normalize line endings, entity references, and attributes; serialization may change quotes or empty-element notation. This is not canonicalization for signatures or byte hashes. Limits are 100,000 characters, 10,000 nodes, and depth 100.
Privacy
Input and results are processed locally in your browser without upload or storage by this tool. XML and string inputs are not executed; results are shown as text. Shared site advertising and analytics may operate separately, but tool-use events do not include your input contents.
Comments & questions