Toolhaus

XML Formatter

Beautify or minify XML and catch mismatched tags.

Output

Formula & methodology

Tokenizes the XML into tags and text, verifies tag nesting with a stack, then re-indents each level (keeping simple text elements on one line).

Worked example

  • <a><b>hi</b></a><a> <b>hi</b> </a>

Frequently asked questions

Does it validate the XML?

It checks well-formedness — that every tag is closed and correctly nested — and reports the first problem. It does not validate against a DTD or schema.

Are comments and CDATA kept?

Yes. Comments, CDATA sections, processing instructions and DOCTYPE declarations are preserved.

Privacy

All processing happens locally in your browser. Your data is never uploaded.

Related tools