XML Formatter
Pretty-print, validate and minify XML documents entirely in your browser.
What is the XML Formatter?
The XML Formatter pretty-prints, validates and minifies XML documents right in your browser. Paste a wall of one-line XML and it returns cleanly-indented markup you can read; paste something with a broken tag and it points out the error.
XML still powers configuration files, RSS feeds, SOAP APIs, SVG assets and many enterprise systems. Reading raw XML from a build step or an API log is painful without formatting — this tool fixes that in one click.
Because the DOM parser used for validation is built into every browser, formatting runs entirely on-device. No XML leaves your machine, which matters when it contains proprietary configuration or PII.
How to use the XML Formatter
- 1Paste your XML into the input area.
- 2Pick an indent size (2 or 4 spaces).
- 3Click "Format" for pretty-printing or "Minify" to strip whitespace.
- 4Click "Validate" for a quick well-formedness check without altering the input.
- 5Copy the formatted or minified output to your clipboard.
Key features
- Well-formedness validation with a clear error message
- Configurable indent (2 or 4 spaces)
- Minify option to shrink payload size
- Handles CDATA sections and comments
- Works on any XML dialect — SVG, SOAP, RSS, config files
- Runs offline
Examples
Format compact XML
<root><a>1</a><b><c>2</c></b></root><root>
<a>1</a>
<b>
<c>2</c>
</b>
</root>Why use this tool
- Turns unreadable XML into scannable markup
- Detects syntax errors instantly
- Cuts payload size when minified
- Preserves comments and CDATA
- Free and private
Common use cases
- Debugging SOAP responses
- Prettifying SVG for editing
- Reviewing RSS feeds before publishing
- Formatting XML config files before commit
- Minifying XML for storage
Frequently asked questions
Does the tool validate against a schema?
It checks well-formedness (correctly nested tags). Full XSD validation is on the roadmap.
Can I format very large XML?
Yes — files up to several megabytes work smoothly on desktop.
Are namespaces preserved?
Yes — xmlns declarations and prefixed tags are untouched.
Does it strip comments?
No — comments and CDATA are preserved in both format and minify modes.
Is my XML uploaded?
No — everything runs in your browser.