DevTool Desk

XML Formatter

Output
<?xml version="1.0" encoding="UTF-8"?>
<class="text-sky-600 dark:text-sky-400">catalog>
  <class="text-sky-600 dark:text-sky-400">book id="1">
    <class="text-sky-600 dark:text-sky-400">title>Learning XML</class="text-sky-600 dark:text-sky-400">title>
    <class="text-sky-600 dark:text-sky-400">author>J. Doe</class="text-sky-600 dark:text-sky-400">author>
  </class="text-sky-600 dark:text-sky-400">book>
  <class="text-sky-600 dark:text-sky-400">book id="2">
    <class="text-sky-600 dark:text-sky-400">title>Advanced XML</class="text-sky-600 dark:text-sky-400">title>
    <class="text-sky-600 dark:text-sky-400">author>A. Smith</class="text-sky-600 dark:text-sky-400">author>
  </class="text-sky-600 dark:text-sky-400">book>
</class="text-sky-600 dark:text-sky-400">catalog>

Paste XML to validate it, then beautify it with your choice of indent width or minify it down to a single line. Invalid XML is flagged using your browser's own XML parser, which reports the exact line and column of the problem. The formatted output is syntax-highlighted for easier reading.

Frequently asked questions

Why does my XML fail validation?

Common causes are a missing closing tag, mismatched tag names, unescaped '&' characters, or multiple root elements. The error message includes the line and column where the parser gave up.

Does minifying change the XML's meaning?

No — minifying only removes whitespace between tags. Whitespace inside text content is preserved so it doesn't change the document's data.