Developer
XML Formatter and Validator
Format, minify and check XML for well-formedness, with every error located in your text.
Runs entirely in your browser. Nothing you paste is uploaded.
0 characters · 0 bytes
This runs entirely in your browser. Nothing you paste is sent to us or to anyone else.
How to use it
- Paste your text into the box marked "Your XML"Paste a document, a fragment, an API response — it does not have to be valid yet. Everything happens inside your browser — nothing is uploaded, so there is nothing for us to store, log or lose.
- Read the result as it updatesThere is no button to press. Choose Format to indent the document or Minify to strip it down, and the result appears immediately underneath. The output recomputes every time you change the text or one of the options above it.
- Set the indentation with the Indent controlTwo spaces, four spaces or a tab. It reformats as soon as you change it, so you can see which one your document reads best in.
- Read the error position when it is not well-formedThe message names the character where parsing stopped. The actual mistake is usually just before it — most often a tag that was never closed.
- Check the notes about what was left aloneMixed content and anything marked xml:space="preserve" are not re-indented, because there the whitespace is part of the data. The notes say when that applied, so an unchanged section is explained rather than looking like a bug.
- Copy or download the resultThe buttons under the output put it on your clipboard or save it as a file, and each one says exactly what it will copy or download. Any note about something the tool changed or deliberately left alone is shown with the result rather than hidden.
About this tool
Paste XML and get it back either neatly indented or minified — and if it is not well-formed, an error message that names the problem and points at the exact character where parsing stopped.
The formatter is deliberately conservative about what it touches. Only insignificant whitespace is changed: the indentation between elements and the decorative edges of text-only content. Mixed content — an element containing both text and markup, like a paragraph with bold words in it — is left exactly as written, because the whitespace between text and tags is part of the text. Content marked xml:space="preserve" and everything inside CDATA sections comes through byte for byte.
Understanding the result
A formatted or minified result means the document is well-formed: every tag closes, every attribute is quoted, entities are complete, and there is exactly one root element. That is XML's minimum bar, and it is what parsers require before they will read the file at all.
An error names what is wrong and where. The position points at the character where parsing stopped — the actual mistake is often just before it, such as the tag that was never closed.
The "worth knowing" notes list anything the tool did or deliberately declined to do, such as leaving mixed content alone or accepting an entity because a DTD might define it.
Example
Input
<order id="42"><item sku="A1"><qty>2</qty></item></order>Output
<order id="42">
<item sku="A1">
<qty>2</qty>
</item>
</order>Limitations
- This checks well-formedness, not validity. Validating against a DTD or an XML Schema requires the schema itself, and claiming a document is "valid" without one would promise more than the tool checks.
- Entities beyond the five XML defines are only accepted when the document carries a DTD internal subset that could declare them — and the tool says it did not check the declaration, because it does not read external DTDs.
- Attribute order and quoting are preserved, never normalised. A formatter that rewrites attributes is making changes nobody asked for.
- Very large documents are bounded by your browser's memory. For multi-megabyte files, a command-line tool such as xmllint is the right instrument.
Questions
Is my XML uploaded anywhere?
No. The whole tool is JavaScript running on your device — there is no request to send. You can confirm it by opening your browser's network tab, or by disconnecting from the internet and using the page anyway.
Why was part of my document not re-indented?
It contains mixed content — text and child elements side by side — or is marked xml:space="preserve". In both cases the whitespace is part of the data, so re-indenting it would change the document, not just its appearance. The notes under the result say which of the two applied.
What is the difference between well-formed and valid?
Well-formed means the syntax is right: tags nest and close, attributes are quoted, entities are complete. Valid means the document also obeys a specific schema — the right elements in the right places. This tool checks the first. The second requires the schema you are validating against.
Why does fail here when it works in HTML?
HTML defines hundreds of named entities; XML defines exactly five (& < > ' "). Everything else must be declared in a DTD or written as a numeric character reference —   for a non-breaking space.
Last updated 2026-08-16.
Related tools
- HTML Formatter and Minifier
Format or minify HTML without changing what the page renders — inline whitespace is load-bearing and treated that way.
- JSON Formatter and Validator
Format, minify and validate JSON entirely in your browser.
- Text and Code Diff
Compare two texts line by line and see exactly what changed, down to the word.