DevUtils

XML Formatter

New

Format, minify, and validate XML online for free. Consistent indentation, well-formedness checking with clear error messages, and one-click minification. Runs entirely in your browser — no signup needed.

0 bytes

About this tool

XML (eXtensible Markup Language) is a text-based format for representing structured data using nested tags, similar in spirit to HTML but designed for data rather than documents. It remains widely used for configuration files (Maven pom.xml, Android layouts), SOAP APIs, RSS/Atom feeds, and document formats like SVG and DOCX. Because XML has no built-in indentation rules, files generated by tools or copied from an API response are often a single unreadable line. This tool formats XML with consistent indentation, minifies it by stripping whitespace, and validates that it is well-formed—reporting the exact parser error if it is not—all in your browser using the native DOMParser.

How to use

  1. 1Paste your XML into the input field.
  2. 2Click "Format" for indented, readable output, or "Minify" to strip whitespace for a smaller payload.
  3. 3Click "Validate" to check well-formedness without changing the input—parser errors are shown with details.
  4. 4Click "Copy" to copy the result to your clipboard.

Frequently asked questions

What does "well-formed XML" mean?
Well-formed XML follows the basic syntax rules of the XML specification: every opening tag has a matching closing tag (or is self-closing), tags are properly nested, there is exactly one root element, and attribute values are quoted. This is different from being "valid," which additionally requires conforming to a specific schema (DTD or XSD).
Why did validation fail even though my XML looks fine?
Common causes: an unescaped "&" or "<" inside text content (use &amp; and &lt;), a mismatched or unclosed tag, multiple root elements, or attribute values missing quotes. The error message reported by the browser's parser usually names the exact problem and its approximate location.
Does formatting or minifying change the data?
No. Both operations only change whitespace between tags—element names, attributes, and text content are preserved exactly. Whitespace that is meaningful (inside a text node) is left untouched; only whitespace-only text between tags is affected.
Is my XML sent to a server?
No. Parsing, formatting, minifying, and validation all happen locally in your browser using the built-in DOMParser and XMLSerializer APIs. Nothing is uploaded.