Skip to main content
Toolgin57 tools

XML Formatter

Loading…

About XML Formatter

The XML Formatter prettifies and validates XML documents instantly. Paste compact or minified XML and get properly indented, human-readable output. Or minify formatted XML by removing all whitespace for production use.

The validator checks for well-formedness: mismatched tags, missing closing tags, invalid characters, malformed attributes, and incorrect nesting. Errors are displayed with the line and column number.

XML is used in configuration files, SOAP APIs, RSS feeds, SVG graphics, Microsoft Office formats (DOCX, XLSX), Android layouts, Maven POM files, and many enterprise data formats.

Everything runs in your browser. Your data never leaves your device.

How to Use XML Formatter

  1. Paste your XML into the input.

  2. Choose Prettify to add indentation or Minify to remove whitespace.

  3. Syntax errors are shown with the line number.

  4. Copy the formatted output.

Examples

Example — Format compact XML
Input
<root><person><name>Alice</name><age>30</age></person></root>
Output
<root>
  <person>
    <name>Alice</name>
    <age>30</age>
  </person>
</root>

Frequently Asked Questions

Does it validate the XML?

Yes — it checks for XML well-formedness: mismatched tags, missing closing tags, invalid attribute syntax, and illegal characters. It does not validate against a DTD or XSD schema.

Can I format SOAP XML?

Yes — SOAP envelopes are standard XML. Paste the full SOAP message and it will be formatted with proper indentation.

Does it preserve XML comments?

Yes — XML comments (<!-- -->) are preserved and properly indented in the formatted output.

Can I format SVG files?

Yes — SVG is XML-based. Paste your SVG code and it will be formatted with proper indentation.

What indentation is used?

2 spaces by default. Switch to 4 spaces or tabs using the indentation selector.