XML Formatter

Pretty-print XML with standardized indentation and nesting.

Tool Panel

Loading tool...
About XML Formatter

Detects XML nesting and indents it, 2 spaces by default. Everything runs locally in your browser.

  • 1

    Two-space indentation, one line per tag by depth. Whitespace between tags is collapsed first, so even a badly laid-out input comes back aligned.

  • 2

    Elements whose only child is text stay on one line: <title>Title</title> is not exploded into three lines, which keeps short elements readable.

  • 3

    The <?xml ...?> declaration, <!DOCTYPE> and comments each get their own line at the current depth, so the output is valid XML.

Related tools

View all
HTML Formatter
Format & Minify

HTML Formatter

Auto-indent and organize HTML markup for better readability.

Format & Minify
HTML Minifier
Format & Minify

HTML Minifier

Minify HTML by removing extra spaces and non-essential characters.

Format & Minify
CSS Minifier
Format & Minify

CSS Minifier

Minify or prettify CSS code for production and maintenance workflows.

Format & Minify
JavaScript Formatter
Format & Minify

JavaScript Formatter

Beautify JavaScript code with consistent indentation and spacing.

Format & Minify
JavaScript Minifier
Format & Minify

JavaScript Minifier

Minify JavaScript to reduce file size for faster page delivery.

Format & Minify
JSON Formatter
Format & Minify

JSON Formatter

Format, validate, and beautify JSON for easier reading and debugging.

Format & Minify