Part of Code & data tools
XML formatter: pretty-print and minify markup online
This tool adjusts layout only—it does not validate against a schema, resolve external entities, or execute scripts inside documents.
How to use this converter
- Paste a full XML document or fragment into the editor.
- Click Format to indent nested elements and attributes.
- Use Minify to remove non-essential whitespace before sending over the network.
- Copy the output into your validator, test suite, or CMS field.
Why pretty-print XML before debugging
One-line XML from logs hides missing closing tags, namespace collisions, and attribute typos. Indentation reveals parent-child hierarchy quickly—especially in deeply nested SOAP bodies or Kubernetes-style config exports.
Whitespace inside text nodes may be significant for some systems. After formatting, verify CDATA sections and mixed content if your pipeline is whitespace-sensitive.
RSS, sitemaps, SVG, and Android layouts
RSS and Atom feeds are XML under the hood—formatting helps spot duplicate `` entries or broken `` values before publish. Sitemap XML benefits from readable `` blocks when auditing crawl budgets.
SVG snippets and Android layout XML paste cleanly here for review. For production SVG, still run through an optimizer if file size matters.
XML vs JSON in modern APIs
Many new APIs prefer JSON, but enterprise integrations still ship XML. Use the JSON formatter for REST payloads and this page for legacy SOAP or config XML—do not assume the same minify rules apply across formats.
Before and after examples
| Original | Converted | Notes |
|---|---|---|
| <root><item id="1"/></root> | Indented <root> with child <item> | Single child element |
| <urlset><url><loc>https://example.com/</loc></url></urlset> | Readable sitemap block | Sitemap review |