XML Formatter & Validator
Pretty-print XML with clean indentation and catch syntax errors by line.
What this tool does
Pretty-print XML with clean indentation and catch syntax errors by line.
How to use this tool
- 1
Paste the XML
Include the whole document, from the declaration or root element to the last closing tag.
- 2
Choose a mode
Pretty print adds indentation for reading; minify removes the whitespace between nodes for compact transport.
- 3
Pick the indent
Two spaces, four spaces or a tab. This affects layout only, never the data.
- 4
Format or fix
If the document is not well formed, the message names the tag and line where the problem begins.
What you can do with it
- Well-formedness check
Opening and closing tags are matched in order, and unclosed or mis-nested tags are reported by line.
- Whitespace you control
Indent a document for reading, or collapse it to one line without touching text or attribute values.
When to use it
- Validating a snippet before shipping it.
- Inspecting a token or header during debugging.
- Cleaning up code pasted from elsewhere.
- Quickly checking a format without installing a package.
How to understand this tool
XML is well formed when every opening tag has a matching closing tag in the right order and attribute values are quoted. That is different from being valid against a schema or DTD: an unknown element name is still well formed, so this tool will accept it.
What it will not do
- It does not validate against an XSD, DTD or any custom schema.
- It does not resolve entities or external references.
- It does not repair broken markup; you have to fix the tag it reports.
Questions people ask
Does it change my data?
No. Only whitespace between nodes is added or removed; attribute values and text are left as they are.
Does it fetch anything from the web?
No. Parsing happens entirely in your browser and nothing is uploaded.
Why is my XML rejected?
The usual causes are a missing closing tag, mismatched tag names or an unclosed quote in an attribute.
One thing worth knowing
This is a lightweight browser tool — for production-critical work, pair it with your normal linters and tests.