ToolFox

XML Formatter

Pretty-print and validate XML with clean indentation — configs, SOAP payloads, sitemaps, RSS.

Paste some XML to format.

How it works

Your input is parsed with the browser's native XML parser, which enforces well-formedness (every tag closed, properly nested, one root). The document tree is then re-serialized with your chosen indentation; elements containing only text stay on one line for readability, and empty elements collapse to the <tag/> form.

Example

Paste <a><b x="1">hi</b><c/></a> and Pretty (2 spaces) yields a three-line, properly indented document. A mismatched tag like <a><b></a> instead reports "Invalid XML" with the parser's reason.

Frequently asked questions

Does it validate against a schema (XSD/DTD)?

No — it checks well-formedness, which is what most day-to-day debugging needs. Schema validation requires the schema itself.

Are comments preserved?

Element structure, attributes and text are preserved; comments and processing instructions may be dropped by the formatter.

Why did my &amp; cause an error?

XML requires & to be written as &amp; unless it starts a valid entity — raw ampersands are the most common XML error.

Is my XML uploaded?

No — parsing and formatting run entirely in your browser.

Related tools