Skip to content
ToolzKit

Developer

XML Formatter

Pretty-print and validate XML documents with clear parser error messages.

Input

Paste XML

Output

Formatted XML appears here.

Paste XML above, or load the example.

About the XML Formatter

This tool indents XML documents for readability and validates them using the browser's built-in DOMParser, surfacing the exact parser error when a document is malformed. It's useful for inspecting SOAP payloads, RSS feeds, configuration files and other XML formats.

How to use it

  1. 01Paste your XML into the input panel.
  2. 02Choose an indent width.
  3. 03Read any validation errors reported below the panels.
  4. 04Copy or download the formatted XML.

Features

  • Validation via the browser's native XML parser
  • Configurable indentation with spaces or tabs
  • Handles self-closing tags and inline open/close pairs correctly
  • Copy and download as an .xml file

Practical examples

Inspecting an RSS feed

Paste a minified RSS or Atom feed to quickly see its item structure and confirm it is well-formed before publishing.

Limitations

  • This is a line-based re-indenter, not a full XML pretty-printer — it does not reformat attributes across multiple lines.
  • Validation relies on DOMParser, which is only available in browser environments.

Privacy

All parsing and formatting happens locally in your browser. Nothing is uploaded to a server.

Read the full privacy policy for how the site as a whole handles data.

Frequently asked questions

Does it validate against an XSD or DTD?

No, it only checks that the document is well-formed XML, not that it conforms to a schema.

Does it preserve CDATA sections?

Yes, CDATA content is treated as ordinary text between tags and kept intact.

Why does my mixed-content XML look odd?

The formatter is line-based and works best on element-only documents; heavy mixed text and element content may not indent perfectly.