Skip to content

Format, indent, and prettify XML documents with customizable indent sizes and tag normalization.

Loading tool

About XML formatter

Validate XML for well-formedness and pretty-print it with 2 spaces, 4 spaces or tabs, or minify it. Options collapse empty elements to <tag/> and keep or drop comments; CDATA sections, processing instructions and the DOCTYPE are preserved. If the input is not well-formed, you get an error instead of output.

Common uses

  • Read a single-line XML API response, SOAP envelope or RSS/Atom feed.
  • Check that a config file such as a Maven pom.xml or Android layout is well-formed.
  • Normalize indentation before diffing two XML files.
  • Minify XML to reduce payload size.

FAQ

What does well-formed XML mean?
Well-formed XML follows the basic syntax rules: one root element, every start tag closed or self-closed, properly nested elements, quoted attribute values and escaped special characters. It is different from validity against a DTD or XSD schema, which this tool does not check.
Is <tag></tag> the same as <tag/>?
Yes. In XML an empty element can be written either way and parsers treat them identically.