Skip to content
Devtoolry

XML Formatter

Pretty print XML documents with proper indentation. Malformed XML is reported with its location.

About the XML Formatter

The XML Formatter pretty-prints XML with clean indentation while keeping mixed content (text with inline elements) on one line, so the meaning of your document does not change.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the XML Formatter

  1. Paste XML or open a file.
  2. Choose the indentation.
  3. Fix any error at the reported line and column, then copy or download the result.

Frequently asked questions

Why is some content kept on one line?

Inside elements that mix text and tags, whitespace is part of the content. Adding line breaks there would change the text, so it is left as written.

Is the XML declaration kept?

Yes, the <?xml ...?> declaration is preserved at the top of the output.