126+ free tools that run in your browser — no uploads, no sign-up

XML Formatter

Format, validate and minify XML documents.

Minified or badly indented XML is hard to read.

About XML Formatter

Pretty-print XML with your choice of indentation, or minify it to a single line. The tool checks that the XML is well-formed and points out the first error. Handles attributes, comments, CDATA and the XML declaration.

Minified or badly indented XML is hard to read. This formatter pretty-prints it with the indentation you choose, or minifies it to one line, and tells you when the XML isn't well-formed.

How to use XML Formatter

  1. Paste your XML.
  2. Choose Format or Minify and pick the indentation.
  3. Copy or download the result, or fix the reported error.

Key features

  • Pretty print with 1, 2 or 4 spaces.
  • Minify to a single line.
  • Well-formedness check with an error message.
  • Keeps attributes, comments, CDATA and the XML declaration.

Common use cases

  • Reading API responses and configuration files.
  • Cleaning up XML before committing it.
  • Reducing XML size for transport.

Frequently asked questions

Related tools

More Developer tools