XML Formatter
Beautify and pretty-print XML with clean indentation, or minify it to one line. Validated in your browser; nothing is uploaded.
An XML formatter re-prints XML with consistent indentation so the nesting of elements is easy to follow, or strips the whitespace between tags to minify it. It is handy for reading a minified API or SOAP response, tidying a config file, or checking the structure of an SVG, RSS feed or sitemap. Paste your XML and press Beautify to indent it, or Minify to collapse it to one line — the document is validated with the browser's own parser first, and formatting never changes your data, only the spacing between elements. Everything runs locally, so nothing is uploaded. To turn XML into JSON instead, use the XML to JSON converter.
Frequently Asked Questions
What does an XML formatter do?
An XML formatter takes XML that is minified, inconsistently indented, or all on one line and re-prints it with clean, consistent indentation so the nesting of elements is easy to read. Each child element is placed on its own line and indented one level deeper than its parent, which makes the document structure obvious at a glance. It does not change the data — the elements, attributes, text content and order are preserved exactly; only the whitespace between tags changes. This tool can also go the other way and minify XML by stripping the whitespace between elements to produce the smallest valid document.
Does formatting change my XML data?
No. Pretty-printing only adds or removes the insignificant whitespace that sits between elements, so the meaning of the document is unchanged — every element, attribute and piece of text content is preserved in the same order. The one thing to be aware of is mixed content and significant whitespace: if an element contains text alongside child elements, or you rely on whitespace inside text nodes, indentation can matter. This tool formats element structure and leaves text content intact, which is the right behaviour for the vast majority of config files, API responses, SVG, RSS and document XML.
Is my XML private or uploaded anywhere?
Yes — the XML you paste stays on your device. The tool parses and formats using the browser's own built-in XML parser, so nothing is ever sent to a server, logged, or stored. There is no account and no sign-up, which makes it safe for config files, SOAP or API payloads, and any document you would rather not upload to a third-party site. Because everything runs client-side, the formatter also keeps working offline once the page has loaded.
What happens if my XML is invalid?
The formatter validates your input using the browser's XML parser. If the document is not well-formed, it shows the parser's error message instead of producing output, so you can find and fix the problem. The most common causes are an unclosed or mismatched tag, a stray or unescaped angle bracket or ampersand, more than one root element, or a missing quote around an attribute value. Fix the reported issue and format again — well-formed XML needs exactly one root element and every opening tag matched by a closing tag.
Can it format SVG, RSS and other XML dialects?
Yes. SVG, RSS and Atom feeds, SOAP envelopes, Android layouts, sitemaps, and most configuration formats are all XML, so the formatter handles them the same way — as long as the document is well-formed. It indents by element nesting without needing to know the specific schema, so you do not have to tell it what kind of XML you are pasting. If a document uses namespaces or a DOCTYPE, those are preserved as written.