Indent XML so nested elements are easy to read, with malformed XML reported instead of guessed.
Try an example
Load a ready-made sample into this tool and run it. Every result you see is calculated live by the tool itself — nothing here is a pre-written answer.
Sample: input: <tools><tool>Word Counter</tool><tool>JSON Form...
How to Use
- Paste XML into the box.
- Click Run.
- Copy the indented result.
What this XML formatter does
This XML formatter indents XML so its nested structure is easy to read. Feeds, config files and API responses often arrive as one continuous line; the formatter places each element on its own line and steps child elements inward, so you can follow where every element opens, what it holds and where it closes. Paste the XML in and copy the tidied result.
How the formatting works
Formatting runs through the browser's XML parser, the same machinery web pages use to read XML. That means the document is genuinely understood before it is printed back, not merely split at every bracket. Fragments are welcome too: a single element copied from a larger file formats on its own, at its own nesting level.
Good to know
Malformed XML is reported, not repaired. If tags are mismatched or a closing bracket is missing, the parser stops and you get a plain explanation rather than a guess at what you meant. Correct the structure in the original, then format the fixed version for a clean reading copy.
Frequently asked questions
Why was my XML reported as malformed?
XML rules are strict: every opened tag must close, attributes need quotes, and elements must nest without crossing. A single mismatch anywhere stops the parser. The message tells you the document has a problem; compare opening and closing tags to locate it.
Does formatting change the data in my XML?
No. Elements, attributes and text keep their content and order; only line breaks and indentation are added between them. A program reading the formatted version sees exactly the same document as the one-line original, just printed more readably.
Can I format a fragment instead of a whole document?
Yes, as long as the fragment is itself well-formed XML, such as one complete element with its children. A loose half of an element — an opening tag with no closing tag — counts as malformed and will be reported.
How to use XML Formatter
- Paste XML into the box.
- Click Run.
- Copy the indented result.
Limitations
Formatting uses the browser XML parser; malformed XML is reported, not repaired.