XML Formatter & Validator
Beautify, minify, validate and explore XML β with XPath testing, tree view and XML β JSON conversion. 100% private, runs in your browser.
Recent XML
Fetch XML from URL
Paste a public URL β we'll pull its raw content via a CORS proxy.
How to Use the XML Formatter
- Pick a mode β Format, Minify, Validate, Tree View, XPath Tester, or convert XML β JSON.
- Add your XML β paste, type, drop a file (.xml, .svg, .rss, .xsd, .htmlβ¦), or fetch from a URL.
- Tweak options β choose indent size, sort attributes, strip comments, preserve CDATA, keep declaration.
- Click "Run" (or enable Auto-run) to see the result instantly in the right pane.
- Test XPath β in XPath mode, type an expression like
//book[@id='b1']/titleand see matches. - Copy, download or share β export as .xml or .json, or copy a self-contained link with the Share button.
What is XML and Why Format It?
XML (eXtensible Markup Language) is a self-describing data format used everywhere β RSS feeds, sitemaps, Office documents, SOAP APIs, SVG graphics, Android resources, configuration files and countless legacy enterprise systems. Unlike JSON, XML supports comments, attributes, namespaces, CDATA blocks and processing instructions, which makes it incredibly flexible but also harder to read when minified.
Our XML formatter uses the browser's native DOMParser plus a custom serializer, so you get standards-compliant pretty-printing with full control over indentation, attribute order and whitespace. The validator flags every well-formedness error with line and column, the tree view turns walls of text into a collapsible explorer, and the XPath tester lets you query the document with one of the most powerful selector languages ever created.
Common Use Cases
Why Choose Our XML Formatter
Frequently Asked Questions
Is my XML uploaded anywhere?
No. Parsing, formatting, validation and XPath all run inside your browser. The only optional network call is "Fetch from URL", which uses a public CORS proxy to retrieve that URL's content β nothing of yours is uploaded.
What XML standards do you support?
We use the browser's native DOMParser, which supports XML 1.0 and Namespaces. XPath uses the standard document.evaluate API, which implements XPath 1.0 β including predicates, axes, functions and namespace resolution for default namespaces.
Can it validate against a DTD or XSD?
This tool validates well-formedness (correct nesting, matched tags, valid characters). Full schema validation against a remote XSD requires server-side libraries and isn't possible purely in-browser. For XSD validation we recommend pairing this with your local toolchain.
How does XML to JSON conversion work?
We follow a sensible convention: element names become object keys, attributes are prefixed with @, text content uses the key #text, and repeated children of the same name become arrays. The reverse (JSON to XML) accepts the same shape.
What about CDATA, comments and processing instructions?
All preserved by default. Toggle "Remove comments" to strip them. CDATA sections (<![CDATA[ β¦ ]]>) are retained as-is when "Preserve CDATA" is on.
What file size can it handle?
Up to ~10MB smoothly. Anything larger may hit browser parser limits for any in-browser XML tool.
Which other tools pair well with this?
Try our JSON Formatter, Text Diff Checker, HTML/CSS/JS Minifier, Sitemap Checker and URL Encoder/Decoder.
Does it work on mobile?
Yes β the two panes stack vertically and every toolbar wraps responsively.
