2026-10-03
XML shows up in feeds, SOAP payloads, build files, SVGs and configuration, and it is often minified or machine-generated into a single unreadable line. Online formatters can make it readable, but they typically ask you to paste the document into a server, which is a poor fit for an API response or a config with internal details.
iLoveDevTools's XML Formatter / Validator uses your browser's built-in XML parser, so the document stays on your device.
Checks well-formedness. Paste XML and the tool reports the first syntax error with a line and column where the browser's parser gives that information. Typical causes are a mismatched tag, an unescaped ampersand, an unquoted attribute or a second root element.
Pretty-prints. Child elements are indented with 2 spaces, 4 spaces or tabs. Elements that contain text keep that text inline, so the formatter does not add whitespace that could change the meaning of the data. Empty elements become self-closing tags.
Minifies. The minify option removes the indentation and line breaks between elements for the most compact form.
Preserves the structure. The XML declaration, doctype, comments, CDATA sections and processing instructions are kept. You can drop comments, or sort attributes alphabetically, with the checkboxes.
This is a well-formedness check, not schema validation. It does not validate against an XSD or DTD, and it does not run XPath or XSLT. A document can be well-formed and still be wrong for your application. Error wording and position details also vary a little between browsers, because each reports parse errors in its own way.
xmllint. The libxml2 command-line tool formats and validates, including against a schema or DTD, and belongs in scripts and build pipelines. If you need schema validation, use it. This tool is for when you have a snippet on the clipboard and want an answer in seconds with no install.
Online XML beautifiers. Many general-purpose sites format XML alongside dozens of other formats. They are convenient, but the document goes to their server. Here parsing and printing are local.
Your editor. IDEs and VS Code extensions format XML and can validate against a schema you point them at. If the file is already open there, that is usually the best workflow.
To turn data between formats such as JSON, YAML and CSV, use the Data Format Converter. The same quick check for JSON lives in the JSON Formatter and Validator, and for YAML in the YAML Formatter.
For private, instant XML formatting and a clear well-formedness error, try the XML Formatter. For schema validation or automated pipelines, use xmllint or your IDE.