Toolhaus

XML Formatter

Beautify or minify XML and catch mismatched tags.

Paste XML to pretty-print it with clean indentation, or minify it to a single line. The formatter also checks that tags are properly nested and reports the first mismatched or unclosed tag. Comments, CDATA sections and declarations are preserved. Runs fully in your browser.

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.

Read the practical guide for this category.

Related tools