XML Formatter
Beautify XML/HTML with indentation matching the tag hierarchy.
What is XML Formatter
XML formatting adds line breaks and indentation according to tag nesting, making the structure of XML or HTML easy to read.
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
Whitespace between tags is not always insignificant
The formatter collapses runs of whitespace that sit between a closing angle bracket and an opening one, then re-indents by element depth. For machine-generated XML that is exactly right: the whitespace was inserted by an earlier pretty-printer and carries no meaning.
For hand-written XML it can be wrong. In mixed content — <p>hello <b>world</b> again</p> — the space before <b> is part of the text, and an aggressive pass can normalise two spaces to one or move text to its own line. The document still parses, but the rendered sentence changes.
Constructs that must be left alone
CDATA sections, xml:space="preserve" subtrees, and element content in XHTML must keep their internal whitespace exactly. A formatter that treats CDATA inner text as ordinary content will alter code samples or embedded scripts.
Attribute order is also worth noting: formatting should preserve it, because while XML says attribute order is insignificant, plenty of real systems diff attribute order and some signing schemes canonicalise it. Reordering attributes can invalidate an XML signature even though the document is logically identical.
Valid versus well-formed
This tool checks balance and structure, which is well-formedness. It cannot tell you whether the document matches a DTD or an XSD — that requires the schema, and it is the check that matters when an integration rejects a payload that looks perfect.
The common real-world failure is an unescaped ampersand in a URL query inside an attribute. & starts an entity reference, so ?a=1&b=2 is not well-formed; it must be written &. Errors like that produce a parse failure pointing at a character that looks completely ordinary.
How to use
- 1.Paste your XML
- 2.Click Format
- 3.Copy the result
How this compares
There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.
| Aspect | This tool | Upload-based converters | Desktop software |
|---|---|---|---|
| Where the file is processed | In your browser, on this page | On the vendor's servers, after an upload | On your own machine, after installing an app |
| Account required | No | Usually — free tiers ask you to sign in before lifting a limit | No, though a licence may be needed |
| Size you can process for free | No size cap, no run limit | A few files per hour, or a ~5–10 MB cap before a paywall | Whatever your disk and RAM allow |
| Price | Free. Pro is $9/month, and only buys larger files and AI features | Usually a subscription — roughly $7–15/month as of November 2026 | A one-off licence, or a subscription |
| Works offline | Yes, once the page has loaded | No | Yes |
| Time before work starts on a 20 MB file | Immediate — there is nothing to upload | Dominated by the upload — about 16 s on a 10 Mbps uplink | Just the app launch |
| What it cannot preserve | Invalid input returns the parser error position instead of a repaired file | The same — the conversion is the same maths | The same, though some desktop apps re-render styles more faithfully |
Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.
Frequently asked questions
What is XML formatting?
It indents tags by nesting level to clarify the structure.
Can I use it for HTML?
Yes, well-formed HTML can be formatted too.
What this kind of conversion cannot keep
Formatters parse the input into a tree and print it back with consistent indentation. If the input is invalid, you get the parser's error position instead of a silently mangled file — malformed JSON stays malformed rather than being «repaired» into something that is no longer yours.
More in Format
On this page
- What is XML Formatter
- What it does with your file
- How it actually behaves
- How to use it
- How this compares
- FAQ
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →