ToolJovia
Developer

XML Formatter

Validate and indent XML locally, preserving mixed text content and rejecting entity declarations.

✓ Browser-local processing

Loading tool…

How to use XML Formatter

Make element-based XML easier to read without executing its contents. For mixed content, CDATA sections, and elements marked xml:space="preserve", the formatter avoids adding indentation inside the element. XML parsing and serialization may normalize line endings and other representation details.

  1. Paste an XML document without a DTD or entity declaration.
  2. Choose indentation and format the document.
  3. Review and download the formatted XML.

Good to know

  • DOCTYPE and custom entity declarations are rejected; external resources are never requested by this tool.
  • Up to 100,000 input characters, 20,000 nodes, and 60 nesting levels.
  • Browser XML serialization may normalize attribute quoting, empty tags, and namespace declarations. Downloads use UTF-8; any existing encoding declaration is updated to UTF-8 to match the file bytes.

Indent a small XML catalog without changing its text

Paste this catalog into Input, choose 2 spaces, and run the formatter. The two nested elements become easier to scan, while the title stays on one line because its text is meaningful content. Copy the result or download formatted.xml, then compare it with the source before replacing a file. This example needs the browser's XML parser; the formatted result below follows the current rendering logic. A document that parses successfully has passed a well-formedness check, not an application schema check. Keep any separately required XSD validation in your own workflow.

Input; choose 2 spaces for Indentation

<catalog><book id="1"><title>Small tools</title></book></catalog>

Expected formatted XML

<catalog>
  <book id="1">
    <title>Small tools</title>
  </book>
</catalog>
Try this in the tool

Common questions

Does this validate an XSD?

No. It checks that the XML is well-formed; it does not validate a schema.

Why was a mixed-content element left on one line?

Inserting whitespace between text and child elements could change the content, so the formatter avoids adding indentation inside it. Parsing and serialization may still normalize line endings and other representation details.

Keep going with related tools

All developer →