About this tool
XML often ships as a single compact line for efficient transport, yet reads best when indented. This tool toggles between the two representations at will.
Built on fast-xml-parser, it first parses the XML into an object model and then serialises it in the chosen mode, preserving attributes, CDATA sections and namespaces.
How to use
- Paste XML or upload an .xml file.
- Pick "Beautify" or "Minify".
- Choose indent width (2 spaces, 4 spaces or Tab).
- Click "Format".
Use cases
- Expand compact XML logs to inspect individual fields.
- Beautify configuration files before committing to keep code reviews pleasant.
- Minify static XML resources during deployment to save bytes.
Notes
- Attribute order and CDATA content are preserved.
- Comments remain in place.
- Badly broken XML is rejected with a parser error.
Frequently Asked Questions
Does beautification change the semantics?
No. Only whitespace is altered; structure, attributes and text remain identical.
Are XML declaration and DOCTYPE preserved?
The XML declaration is re-emitted. DOCTYPE is not rewritten in this release; keep it manually if needed.
Does it support namespaced XML?
Yes. Namespace prefixes are retained in the output.