XML Formatter & Minifier

About this tool

Format pretty-prints XML with 2-space indentation, putting each element, comment and CDATA section on its own line, while keeping attributes on the opening tag and preserving simple text content inline. Minify strips the whitespace between tags to produce a compact single-line document.

The input is parsed and validated with the browser's native DOMParser, so malformed XML is reported as an error instead of producing broken output. The document tree is then walked recursively to emit the indented result. Everything runs locally in your browser — nothing is uploaded.

Related tools

JSON FormatterHTML EscapeJSON to YAML