XML Formatter
Beautify, minify & validate XML.
100% private — runs in your browser, nothing is uploaded.
Paste XML on the left.
Validated with your browser's native XML parser — nothing is uploaded.
How to use the XML Formatter
- 1Paste your XML
Config files, SOAP payloads, RSS feeds, sitemaps — anything XML.
- 2Choose beautify or minify
Pretty-print for reading, or minify for size.
- 3Fix any errors
Invalid XML shows the parser's error message.
- 4Copy the result
One click copies the formatted document.
Examples
| Input | Output |
|---|---|
<a><b>text</b></a> | <a>
<b>text</b>
</a> |
<item id="1"/> (empty) | <item id="1"/> (self-closing kept) |
Beautify, minify and validate XML
This XML formatterturns wall-of-text XML into a cleanly indented, readable document — or squeezes a formatted one down to a single line for transfer. Input is validated with the browser's native parser first, so malformed markup produces a clear error message rather than silently mangled output.
Made for real-world XML
SOAP envelopes, RSS and Atom feeds, Maven and Android config files, SVG, sitemaps, invoice formats — XML remains everywhere, and most of it arrives minified. The formatter preserves namespaces, attributes, comments, CDATA sections and the XML declaration, keeps single-text elements on one line for compactness, and renders empty elements in self-closing form.
Private and instant
Everything runs client-side — enterprise payloads and config files never leave your machine, and formatting is instant even for large documents. Working with other data formats? Try the JSON formatter or the YAML ↔ JSON converter.
Frequently Asked Questions
How do I format XML online?
Paste your XML into the input, pick an indent size, and the beautified version appears instantly with one element per line and nested indentation. A copy button grabs the result.
Does the tool validate my XML?
Yes — it parses your input with the browser's native XML parser first. If the document is malformed (unclosed tag, bad entity, mismatched nesting), you get the parser's error message instead of broken output.
What's the difference between beautify and minify?
Beautify adds line breaks and indentation for humans; minify strips inter-tag whitespace to shrink the file for transfer. Both preserve the document's actual data, attributes, comments and CDATA.
Why does whitespace in XML matter?
Whitespace between elements is usually insignificant, but whitespace inside text content is real data. This formatter only reflows the structural whitespace and keeps text content intact.
Does it handle namespaces, comments and CDATA?
Yes. Namespaced tags like <soap:Envelope>, XML comments, processing instructions and CDATA sections are all preserved through both beautify and minify.
Is my XML uploaded to a server?
No — parsing and formatting run entirely in your browser, so config files and API payloads stay private.