Pretty-print, validate and minify XML in your browser, with line and column error messages, adjustable indentation and attribute sorting.
Minified or machine-generated XML is nearly unreadable, and a single unclosed tag or stray ampersand can make a feed, a SOAP payload or a config file fail to load. This tool checks that your XML is well-formed using the browser's own parser, reports the line and column of the first error, and pretty-prints valid documents with the indentation you choose, or minifies them to a single line. It checks well-formedness only (it does not validate against a schema or DTD). Everything runs in your browser. For JSON, YAML and CSV, see the JSON Formatter and the Data Format Converter.
Well-formed means the XML follows the basic syntax rules: one root element, every tag closed and properly nested, attribute values quoted, and special characters escaped. Valid means it also matches a schema or DTD. This tool checks well-formedness only and does not validate against an XSD or DTD.
The usual causes are an unclosed or mismatched tag, an unescaped ampersand or less-than sign in text (write & and <), an unquoted attribute value, two root elements, or content before the XML declaration. The error message names the line and column where the parser gave up, which is often just after the real mistake.
It only changes whitespace between elements. Elements that contain text keep that text on one line with its content intact, so no significant whitespace is invented, and comments, CDATA sections and processing instructions are preserved (comments can be dropped with the option).
It removes the line breaks and indentation between elements so the document is as compact as possible, which is useful for payloads and config values. Text content is kept, with runs of whitespace inside text collapsed to a single space.
Any current browser, since it uses the built-in DOMParser. Error message wording and position details can differ slightly between browsers because each reports parse errors in its own format.
No. Parsing and formatting are done by your browser, so configuration files, API responses and documents never leave your device.
← All tools · Blog · Cheat sheets · FAQ