XML Formatter & Beautifier
Paste a wall of single-line, tab-mangled XML and get clean, properly indented markup back in a single click. This is a free online XML formatter and beautifier that runs entirely in your browser — pretty-print messy XML instantly, or minify it back down when you need it small.
A free browser tool · Updated 29 May 2026
What this XML formatter does
XML you copy out of a log line, an API response, or a config dump almost never arrives readable. It comes as one endless line, or with random tabs and ragged indentation that fights you when you try to follow the nesting. A formatter fixes that: it re-lays the same markup with consistent indentation so every opening tag lines up with its close, and the structure becomes something you can actually scan.
Two operations cover almost everything you'll want:
- Beautify — take compact or messy XML and re-indent it into a clean, readable tree.
- Minify — strip the whitespace back out to ship the smallest possible payload.
Both run client-side. There's no backend doing the work — your browser's own XML engine parses the document and rewrites it, so nothing you paste is sent anywhere.
Beautify: pretty-print messy XML
Say you paste this — a perfectly valid SOAP-ish response, but unreadable on one line:
<order id="42"><customer><name>Alice</name><city>Tbilisi</city></customer><items><item sku="A1">Widget</item><item sku="B2">Gadget</item></items></order>
Click Beautify and you get the same document, re-indented so the hierarchy reads top to bottom:
<order id="42">
<customer>
<name>Alice</name>
<city>Tbilisi</city>
</customer>
<items>
<item sku="A1">Widget</item>
<item sku="B2">Gadget</item>
</items>
</order>
Attributes stay attached to their elements, text content keeps its place, and the indentation is consistent all the way down. The editor also colors tags, attributes, and values as you go, so the shape of the document pops even before you read a single tag name.
Minify: collapse XML back to one line
Formatting is for humans; minifying is for machines. When you're done reading and want to paste the document into a request body, a fixture, or a field that's sensitive to size, click Minify. The formatter removes the indentation and the whitespace between tags and hands you back a single compact line — the same markup, just smaller.
It's a clean round trip. Beautify to understand a document, edit it comfortably, then minify before you send it. Nothing about the actual data changes — only the whitespace that surrounds it.
How to format your XML
1 Paste or upload your XML
Open the viewer and paste your XML into the editor with Ctrl+V (or Cmd+V on Mac). Prefer a file? Click the upload button and pick any .xml file. Everything is parsed in your browser — there's no upload to a server.
2 Click Beautify or Minify
In the editor toolbar, hit Beautify to pretty-print the document with clean indentation, or Minify to collapse it back to one line. Invalid markup is caught up front with a clear message pointing at what broke, so you're never staring at a silent failure.
3 Read, search, or switch views
Once it's formatted, type in the search box to jump to any tag or value, switch to Tree view to fold and unfold branches, or use Table view when your XML has repeated elements you'd rather scan as rows. Then copy the result back out.
Why it stays private
The whole tool is a single HTML page. There is no API, no upload endpoint, and no account. Your XML is parsed and rewritten by the browser's built-in engine, which means we — the people running the site — can't see what you paste even if we wanted to. That matters when the document is a production payload, an auth response, or anything you'd rather not hand to a random web service.
Big files and edge cases
The formatter is built to handle real-world XML, not just toy snippets:
- Large documents. Multi-megabyte files format without freezing the tab — parsing runs off the main thread so the UI stays responsive.
- Comments and CDATA.
<!-- comments -->and<![CDATA[ ... ]]>blocks are preserved through a beautify/minify round trip rather than being stripped. - Namespaces. Prefixed tags like
soap:Envelopeoritunes:authorkeep their prefixes intact. - Broken markup. If a tag isn't closed or an entity is malformed, you get a specific error instead of garbled output — fix it and re-run.
If your XML happens to be a feed, a SOAP envelope, or a Maven POM, formatting is only the start — the same viewer can render those as a searchable table. Try the worked Atom feed, SOAP response, or pom.xml examples to see it.