Beautify, minify, and validate XML documents, convert back and forth between XML and JSON, or run a namespace-aware XPath 1.0 query — 100% in your browser.
{{ entry.uri }}No xmlns declarations found in this document.
An unprefixed default namespace was found — use prefix default to match it (e.g. //default:item); a bare //item in XPath 1.0 matches only elements with no namespace at all, never the default one.
A custom prefix overrides an auto-detected one of the same name — useful when the document itself uses no prefix (or a different one) than what's convenient to type here.
{{ xpathResult.error }}
No nodes matched.
Enter an XPath expression above — a node-set (//item), a number (count(//item)), a string (name(//item[1])), or a boolean (//item[1]/@id = "2") are all valid results.
This tool utilizes the native browser DOMParser interface to parse, validate and format XML safely without external network calls. Format and Minify only add or remove whitespace they can prove is insignificant — an element is only reformatted with new indentation when its content is elements-only; anything with real text, CDATA, comments, processing instructions, or an xml:space="preserve" attribute is left exactly as written instead.
XML ↔ JSON mapping: attributes become @name keys, and text mixed with child elements becomes a #text key — both round-trip back to XML. Comments and processing instructions have no JSON equivalent and are dropped on XML → JSON (not silently — this is that disclosure); CDATA content becomes plain JSON text. XML has no native array type, so repeated same-name siblings become a JSON array, and on the way back a JSON key that isn't a valid XML tag name is reported as an error instead of producing broken markup.
XPath & namespaces: queries run through the browser's own document.evaluate() (XPath 1.0) — not a reimplementation, so operator precedence, axes and functions match what any XPath reference documents. Namespace prefixes used anywhere in the document are auto-detected from its xmlns:* declarations; a default (unprefixed) xmlns is exposed under the reserved prefix default, since XPath 1.0 has no syntax to match a default-namespaced element without binding it to some prefix first. A result is a node-set, a number, a string, or a boolean depending on what the expression itself computes — the query box accepts any of the four, not just node-selecting expressions.
XSD/DTD schema validation — not implemented, by design, not by oversight: DOMParser only checks that a document is well-formed XML; it is not a schema validator and has no way to check it against an XSD or DTD's actual content rules. Adding a real one would mean shipping a substantial validation engine (or a WASM build of one like libxml2, tens of megabytes) for a use case most of this tool's audience doesn't hit day to day — evaluated and deliberately left out rather than half-implemented. Separately, and for a real security reason rather than a scope one: this tool never resolves an external DTD or entity a document references (`<!DOCTYPE foo SYSTEM "...">`) — browsers' own DOMParser already refuses to fetch one, and that is treated as a hard requirement here, not just inherited default behavior, since resolving external entities is exactly the XXE (XML External Entity) vulnerability class.
Parsing happens entirely in your browser. Nothing you paste is uploaded. XML documents can carry secrets too (config files, SOAP credentials, signed tokens) — this page keeps only your indent-size preference between visits, never the document itself.