DevToolbox

XML Formatter

Format, minify, and validate XML documents with pretty indentation.

Processed locally in your browser

XML Input

Output

What is the XML Formatter?

The XML Formatter beautifies, minifies, and validates XML documents. XML remains widespread in enterprise APIs (SOAP), configuration files, RSS/Atom feeds, and document formats — and like JSON, it usually arrives as an unreadable single line.

Validation uses the browser's built-in XML parser, which catches structural problems like mismatched tags, unclosed elements, and invalid characters. Formatting applies clean, consistent indentation while keeping simple elements like <title>text</title> on one line for readability.

How to use the XML Formatter

  1. Paste your XML into the input editor (or click Example to load a sample).
  2. Click Format to beautify with indentation, or Minify to strip whitespace.
  3. Fix any structural errors reported with line details.
  4. Copy the result or download it as an .xml file.

Examples

Minified input

<note><to>Ada</to><body>Ship it &amp; celebrate</body></note>

Formatted output

<note>
  <to>Ada</to>
  <body>Ship it &amp; celebrate</body>
</note>

Frequently asked questions

Does the formatter validate against a DTD or XSD schema?

No. It checks that the document is well-formed XML (proper nesting, closed tags, valid syntax). Schema validation against a DTD or XSD is not performed.

Is my XML processed locally?

Yes. Parsing and formatting use your browser's built-in XML machinery — nothing is uploaded, and parsed markup is never executed or rendered.

Why do I get an error about an undefined entity?

Plain XML only defines five entities: &amp;, &lt;, &gt;, &quot;, and &apos;. HTML entities like &nbsp; are not valid in XML unless declared in a DTD.