ToolHub
<>

XML Formatter

Pretty-print or minify XML documents.

Basic formatting: indentation-aware pretty printer. Text content and comments are preserved.

About the XML Formatter

Pretty-print or minify XML documents with proper indentation at 2 spaces, 4 spaces or tabs. The parser checks well-formedness first and reports the exact error line if something is broken, while text content and comments are preserved during formatting. Ideal for cleaning up sitemaps, SOAP responses and config files.

How to use the XML Formatter

  1. Paste your XML into the input area.
  2. Pick an indentation width or choose tabs.
  3. Tick Minify when you need a compact single-line version instead.
  4. Copy the formatted output, or fix the reported error if the XML does not parse.

XML Formatter FAQ

Does it validate my XML?

It checks well-formedness โ€” every tag must close correctly โ€” but not DTD or schema validity. A parsererror is surfaced with its message so you can locate the problem.

Are comments and text preserved?

Yes. Comments, processing instructions and text content survive both beautify and minify; minification only collapses whitespace between tags.

Can it handle large documents?

Formatting is a browser-side text transform, so documents of several megabytes work, though the browser editor itself becomes the practical bottleneck.