Paste your XML
An API response, a configuration file, a feed, a sitemap or an export.
Paste XML to get it indented and readable, or minified to save space. It is checked at the same time, and a malformed document is reported with the reason.
100% private — your text is processed in your browser and never sent to any server.
An API response, a configuration file, a feed, a sitemap or an export.
Pick the indentation, or remove all the whitespace.
If the XML is not well formed, the reason is shown.
XML often arrives on a single line, machine-generated and impossible to read: a SOAP response, a sitemap, an RSS feed, an Android layout, a Maven file or an export from an accounting program. Formatting adds line breaks and indentation so the structure is visible, and minifying does the opposite for storage or transmission. Either way, it helps to know at once whether the document is well formed.
The formatter indents every nested element by the number of spaces you choose, or with tabs, and puts each element, comment and processing instruction on its own line. Attributes are kept in their original order and their values are escaped correctly. Elements that contain only text stay on a single line, and elements that mix text and other elements, such as a paragraph with a bold word, are left inline so that the meaning of the content, and the spaces that matter in it, are not changed. Comments, CDATA sections, the XML declaration and the document type declaration are all kept.
Minifying removes the whitespace that only exists to make the document readable, the line breaks and indentation between elements, while keeping the text content as it is. The tool shows the size before and after so that you can see how much is saved.
Before doing anything, the document is parsed according to the XML rules. A tag that is not closed, elements that overlap, an attribute without quotes, an unescaped ampersand or a document with two roots all produce a message that names the problem and where it is. Well-formed means correct syntax; it does not mean the document follows a particular schema.
It does not validate against an XSD or DTD, it does not resolve entities defined in a DTD, and the declaration of a document type may be simplified. It does not change namespaces or reorder attributes. For very large files the browser's memory is the limit. For JSON, use the JSON formatter.
More utilities that also run without leaving your browser.