XML Formatter & Beautifier — Format XML Online

Convert compact or malformed XML into clean, indented markup with proper tag nesting. Ideal for inspecting API responses, config files, and SOAP payloads.

Key Features

How to Use

  1. Paste your minified or single-line XML into the input box.
  2. Select your preferred indent size (2 spaces or 4 spaces).
  3. Click "Format XML" to indent the document structure.
  4. Review the clean hierarchy in the output viewer.
  5. Copy the formatted XML to your clipboard or download it.

Example

Sample input

<catalog><book id="bk1"><title>XML Guide</title><price>29.99</price></book></catalog>

Sample output

<catalog>
  <book id="bk1">
    <title>XML Guide</title>
    <price>29.99</price>
  </book>
</catalog>

Edge Cases

Frequently Asked Questions

Will formatting corrupt CDATA sections in my XML?

No. CDATA sections (<![CDATA[...]]>) are treated as literal raw content and are preserved without any internal reformatting or modification.

Does this tool validate XML against an XSD schema?

It validates well-formedness according to the XML specification (matching tags, quotes around attributes), but does not check against external DTD or XSD schemas.

Can it handle self-closing tags like <item />?

Yes. Self-closing elements are recognized and formatted cleanly without introducing superfluous closing tags.

Related Tools

Privacy notice: when you run this tool, your input is sent over HTTPS to our server, processed in memory and returned. It is not stored or logged. Avoid pasting live secrets such as private keys or passwords.