XML Formatter

Format, validate, minify and diff-friendly-sort XML; convert XML ↔ JSON; test XPath queries live; escape and unescape entities — with element/attribute/depth stats. Everything runs in your browser.

Advertisement
Output appears here — runs automatically as you type.
Advertisement

An XML formatter built for development work

Format and validate XML with precise error line numbers, minify for payloads, sort attributes for stable diffs, strip comments for release builds, convert XML to JSON and JSON back to XML (attributes preserved with an @ prefix, text nodes as #text), test XPath expressions against your document using the browser's native evaluator, and escape or unescape entities — all locally in your browser, so API responses and config files containing secrets never leave your machine.

XPath testing

Pick "XPath query", paste your document and type expressions like //book[@id='b1']/title or //@currency — matches update live as you type, with a match count and each result serialized below.

Frequently asked questions

How is XML converted to JSON?

Attributes become @name keys, repeated sibling elements become arrays, mixed text becomes #text, and numeric/boolean strings are coerced. The mapping is reversible with the JSON → XML action.

Does it validate against a schema (XSD)?

It checks well-formedness — the level browsers support natively. Schema validation needs a server-side validator.

Is my XML uploaded?

No — parsing uses the browser's built-in DOMParser; nothing is sent anywhere.