XML Formatter
Pretty-print or minify XML, with validation, all local.
Reformat XML, minify it, or browse it as a tree
This tool parses XML and offers three views: an indented pretty-print, a minified single-line version, and a collapsible element tree showing tags, attributes and text nodes. It's suited to cleaning up a minified SOAP response, a config export, or an RSS feed into something readable, or the reverse when you need XML compact for a request body. Element order and mixed content are preserved through parsing, and the whole process runs on a JavaScript parser in your browser tab.
How to use the XML Formatter
- Paste XML into the left panel, or click Example to load a sample document.
- Switch between the Format, Minify and Tree buttons to change the output view.
- Read the pretty-printed or minified XML in the right panel, or expand nodes in Tree view.
- Watch the footer under the input panel for a parse error if the XML is not well-formed.
- Copy the result or use the send-to menu to pass it into another tool.
Parsing preserves document order and mixed content, meaning text nodes interleaved with child elements survive reformatting, which matters for markup-like XML such as XHTML fragments where whitespace and ordering carry meaning.
The formatter requires well-formed XML with a single top-level structure; unclosed tags, mismatched nesting or no elements at all will surface as a parse error rather than a best-effort output.
Frequently asked questions
- Does the formatter validate XML, or just reformat it?
- It validates as a side effect of parsing: if the document is not well-formed, such as an unclosed or mismatched tag, parsing fails and the error appears in the input panel instead of a formatted result.
- What does the Tree view show that the formatted text doesn't?
- Tree view renders each element, its attributes and its text content as an expandable, collapsible structure, which is easier to scan for a specific nested tag than reading indented raw markup line by line.
- Is my XML uploaded when I format or minify it?
- No, parsing, formatting and minifying all happen with the fast-xml-parser library running in your browser tab, so a config export or API payload never leaves your device.
- Does minifying remove whitespace between all tags?
- Yes, Minify mode collapses whitespace between elements down to none, producing a single compact line, which is useful for shrinking a payload before sending it, though it also removes readability.