XML formatter

Paste XML to indent it neatly, minify it, or check it is well-formed. You can also convert XML to JSON and JSON back to XML. Nothing is uploaded.

What counts as well-formed XML?

The validator checks all of these and reports the line and column of the first problem. It does not check against a DTD or XML Schema.

How XML maps to JSON

XMLJSON
<title>Rain</title>"title": "Rain"
<book id="1">"book": { "@id": "1" }
Text next to child elements or attributes"#text": "…"
Repeated <tag> elementsAn array: "tag": ["a", "b"]

Values stay as text, because XML has no number type. Converting JSON back to XML follows the same rules, so the two directions round-trip.

Frequently asked questions

How do I format XML?
Paste it into the box with Format selected. It is indented as you type, and short elements stay on one line.
Why is my XML invalid?
The status line shows the first problem and where it is, such as a tag closed in the wrong order, an unquoted attribute, or text outside the root element.
Are comments kept?
Format keeps comments. Minify removes them, along with whitespace between tags.
Is my XML uploaded?
No. It is parsed and formatted in your browser.