XML Formatter
Format and validate XML documents
XML Formatter reformats XML by tracking which tags are opening, closing, or self-closing, and indenting each line according to its nesting depth — turning a single dense line into a readable, properly nested document.
How to use XML Formatter
- 1
Paste your XML.
- 2
Click "Format" to reformat it.
- 3
Review the indented, nested output.
- 4
Copy the formatted XML.
Everything you need to know about formatting XML
What does this do?
Reindents minified or single-line XML with proper nesting and line breaks, and validates that it's well-formed — flagging unclosed tags or structural errors that are hard to spot in unformatted markup.
When you actually need this
- Reading a config file or API response delivered as compressed, single-line XML.
- Debugging a malformed XML document before it's parsed by code that will fail on invalid structure.
Related Developer Tools
JSON Formatter
Format, validate and beautify JSON with syntax highlighting
JSON Minifier
Minify and compress JSON by removing whitespace
JSON Viewer
Interactive tree view for exploring complex JSON data
YAML Formatter
Format, lint and validate YAML files
CSV to JSON
Convert CSV files or data to JSON format
JSON to CSV
Convert JSON arrays to CSV format
Frequently Asked Questions
Does this validate that my XML is well-formed?
It reformats based on recognizing opening, closing and self-closing tags, but it doesn't perform full schema or DTD validation — badly malformed XML may format oddly rather than throwing a specific error.
Does this handle self-closing tags and XML declarations correctly?
Yes — tags like <tag/> and the <?xml ...?> declaration are recognized as self-closing and don't trigger an indent increase for following lines.
Will this work on XHTML or other XML-based formats?
Yes — the same tag-tracking logic applies to any well-formed XML-style markup, including XHTML.
Does this tool send my XML to a server?
Yes — it's sent to our servers to format and the result is returned to you; nothing is stored.
Is this tool free to use?
Yes — completely free, with no signup and no usage limits for casual use.