XML Formatter

Free online XML formatter — beautify and indent XML, minify it, and catch mismatched tags, entirely in your browser. Nothing is uploaded.

Runs entirely in your browser — nothing you enter is uploaded or stored.

Ask about this tool on

Pretty-print and minify XML in your browser

Paste any XML document and this tool re-indents it so the structure is easy to read, or collapses it to a single compact line. It is a dependency-free formatter that runs entirely on your machine, so it is safe for configuration files, SOAP payloads and other sensitive data.

What it handles

  • Nested elements, indented one level per depth.
  • Self-closing tags such as <br/>, comments <!-- … --> and declarations <?xml … ?> on their own lines.
  • Whitespace-only text between tags is dropped when formatting.
  • Basic well-formedness checks for mismatched or unclosed tags.

Frequently asked questions

How does the formatter decide where to indent?

It tokenizes your XML into tags and text, then adds one level of indentation after every opening tag and removes one before each closing tag. Self-closing tags, comments and declarations stay on their own line without changing the depth.

What counts as invalid XML here?

A closing tag that does not match the most recently opened tag, or an element that is never closed. When that happens you get an error naming the tag involved, and the output is left blank.

What does Minify do?

It removes the whitespace between tags so the whole document sits on a single line — handy for shrinking payloads. It does not touch the text inside your elements.

Is my data uploaded?

No — everything runs locally in your browser. Nothing is uploaded.

Related tools