Format
Rewrites your XML with each element on its own line and nested elements indented. Turns a wall of tags into a clear tree you can read.
<a><b>x</b><c>y</c></a>After<a>
<b>x</b>
<c>y</c>
</a>Paste XML to check it, then format it with clean indentation or minify it. The tool tells you right away if the XML is well formed, and points at the exact line and column when it is not. Everything runs in your browser, so your data stays on your device.
XML is a plain text format that stores data inside nested tags, used in config files, RSS feeds, SVG images, sitemaps, and many APIs. When it is packed onto one line it is very hard to read. Formatting rewrites the XML with each element on its own line and nested elements indented, so the tree structure is clear. This tool formats your XML, checks that it is well formed, and can minify it back down when you need the smallest version.
Rewrites your XML with each element on its own line and nested elements indented. Turns a wall of tags into a clear tree you can read.
<a><b>x</b><c>y</c></a>After<a>
<b>x</b>
<c>y</c>
</a>Removes the spaces and line breaks between tags to give you the smallest XML on as few lines as possible. Good for saving space or sending over the wire.
<a>
<b>x</b>
</a>After<a><b>x</b></a>Checks that your XML is well formed as you type: every tag closed, properly nested, one root element. Errors show the exact line and column.
<a><b>x</c>AfterError on line 1: tag
mismatch b and cChoose 2 or 4 spaces for each level of nesting, so the formatted XML matches the style used in the rest of your project.
2 spaces or 4 spacesAfterYour choice per levelThe checker tests whether your XML is well formed, which means it follows XML's basic rules. These mistakes cause most errors:
| Problem | Example | Fix |
|---|---|---|
| An ampersand in text | <name>Tom & Jerry</name> | Write it as & |
| A less-than sign in text | <if>a < b</if> | Write it as <, or wrap the text in a CDATA block |
| Tags that do not match in case | <Item>...</item> | XML is case sensitive, so both tags must match exactly |
| Tags closed in the wrong order | <b><i>text</b></i> | Close the inner tag first: </i></b> |
| More than one root element | <a/><b/> | Wrap everything in a single parent element |
| An attribute value without quotes | <item id=5> | Quote every value: id="5" |
Well formed means the XML follows the syntax rules above, so any XML reader can open it. Valid goes a step further: the document also matches a schema (an XSD or DTD) that says which elements and attributes are allowed and in what order.
This tool checks that XML is well formed. It does not check it against a schema, so a sitemap, RSS feed, or config file can pass here and still be rejected by a program that expects particular elements. For that, use the validator that comes with the program or the schema's own tools.
XML turns up in a lot of places, and it is often packed onto one line. Here are the most common reasons people format and check it: