Remove XML namespaces
Namespaces make XPath and XSLT painful for one-off work. This strips prefixes from element and attribute names and removes xmlns declarations, so //soap:Body/ns2:result becomes plain //Body/result.
Namespace remover
The document is parsed, then rebuilt node by node into a new namespace-free document. Element and attribute names lose their prefixes, xmlns and xmlns:* declarations are dropped, and text, CDATA and (optionally) comments are carried across unchanged.
How to use it
- Paste the namespaced XML, or drop the file on the left pane.
- Leave Remove on prefixes + declarations for the usual case: a document you want to query with simple XPath.
- To strip just one vocabulary, type its prefix into Only this prefix — everything else keeps its namespace.
- Copy the result, or download it.
Why bother
Namespaces exist so vocabularies can be mixed without name collisions, and in a real integration they matter. But for reading a SOAP response, extracting values from an Office document, or writing a quick XPath in a browser console, they are pure friction: document.evaluate needs a namespace resolver, and most one-line XPath expressions silently match nothing when a default namespace is in play.
Stripping namespaces makes those expressions work as written. It is a working copy, not a replacement for the original.
The three modes
- Prefixes + declarations — the full strip. Names become local names and every
xmlnsattribute disappears. This is what you want before an XPath session. - Prefixes only — names are stripped but the declarations stay. Useful when a consumer inspects the declarations but matches on local names.
- Declarations only — names keep their prefixes while the declarations go. The result is technically not namespace-well-formed; it is occasionally handy for tools that treat prefixes as plain text, but do not ship it.
What it changes about meaning
Removing namespaces loses information. Two elements from different vocabularies that shared a local name are now indistinguishable, and a document validated against an XSD will no longer validate, because the schema targets a namespace. Keep the original as the source of truth and treat the output as a convenience copy.
FAQ
Will the result still validate against my XSD?
No. A schema declares a targetNamespace, and the stripped document no longer belongs to it. Validate the original; use the stripped copy for querying and reading.
Can I remove just the SOAP envelope namespace?
Yes — put soap (or whatever the prefix is) into Only this prefix. Elements with that prefix lose it and everything else is untouched.
What happens to a default namespace with no prefix?
Its xmlns="…" declaration is removed in the modes that strip declarations. Element names are already unprefixed, so they do not change — but they stop being in the namespace, which is exactly what makes plain XPath match again.
Are comments and CDATA kept?
CDATA always, comments unless you untick keep comments. Both are copied verbatim into the rebuilt document.
Is my document uploaded?
No. The rebuild happens in the browser using its own DOM implementation.
Related tools
- XPath Tester — the reason most people strip namespaces
- XML Formatter — re-indent or minify the stripped document
- XSLT Tester — transform without wrestling with prefixes
- XML Diff — confirm nothing but the names changed
- XML Stats — list the namespaces a document actually uses
Privacy
100% client-side. The document is rebuilt locally by your browser. See the privacy policy.