The XML Formatter turns hard-to-read XML into clean, indented markup, checks that it's well-formed, validates it against an XSD schema, and converts it to JSON. Everything runs in your browser, so you can safely paste SOAP responses, configuration files or data exports. This guide walks through each feature and the problems it helps you solve.
You can get XML into the tool three ways:
.xml or .txt file with the upload button.Click Format (or press Alt + Shift + F) to indent the document. Each nested element moves onto its own line, one level deeper than its parent:
Before:
xml<order id="o1"><customer>Asha</customer><items><item sku="A-100" qty="2">Notebook</item></items></order>
After:
xml<order id="o1"> <customer>Asha</customer> <items> <item sku="A-100" qty="2">Notebook</item> </items> </order>
Formatting changes only the whitespace between elements, not your data. One exception to keep in mind: in mixed content, where text and tags are interleaved (<p>Click <b>Save</b> now</p>), added whitespace can change how the text is displayed by some consumers. For documents like XHTML, review the result before saving it.
Click Minify (or press Alt + Shift + M) to remove the whitespace between tags. Minified XML is smaller to send over the network and to store, and it's what many APIs expect in request bodies. Like formatting, minifying doesn't change element names, attributes or text.
Every time you format or minify, the tool parses your input. If the XML isn't well-formed, you'll see the parser's error message instead of output. The most common causes are:
<user> needs a matching </user>, and names are case-sensitive, so <User> doesn't close <user>.& for & and < for < in text and attribute values. Unescaped ampersands in URLs and company names are the most frequent culprit.id=42 must be id="42".<?xml ...?> must be the very first thing in the file, with no whitespace or byte order mark before it.For a deeper explanation of each rule, see How to format and validate XML.
Well-formed XML can still be wrong for the system that receives it, for example when a required element is missing or a value has the wrong type. If you have the XSD (XML Schema Definition) for the format, open XSD Schema Validation, paste the schema, and the tool lists every place your document breaks it. Validation runs locally with libxml2 compiled to WebAssembly, the same library many servers use.
Typical schema errors look like "Element 'qty': 'two' is not a valid value of the atomic type 'xs:integer'" or "Missing child element(s). Expected is ( customer )". Each points to the element that needs fixing.
Click Export JSON to convert the document to JSON and download it. This is handy for inspecting XML data with JSON tools such as the JSON Formatter, or for migrating data to a JSON API.
Conversion isn't perfectly lossless, because the formats model data differently. Attributes become keys, repeated elements become arrays, and every value arrives as a string. Check the shape before you rely on it in code; XML vs JSON explains what to look for.
Click Compare to open a side-by-side diff of two XML documents. Format both first so the diff shows real changes rather than whitespace. This is useful for checking what changed between two API responses or two versions of a configuration file.
| Action | Shortcut |
|---|---|
| Format XML | Alt + Shift + F |
| Minify XML | Alt + Shift + M |
| Copy formatted XML | Alt + Shift + C |
| Clear input | Alt + Shift + X |
Click the keyboard icon in the toolbar to see the full list at any time.