xmltoolskit.org
XML utilities, in the browser
Say hi →

Remove XML namespaces

updated 20 August 2026 · prefixes · xmlns declarations

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.

namespaces
Drop a .xml file here, or
ready

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

  1. Paste the namespaced XML, or drop the file on the left pane.
  2. Leave Remove on prefixes + declarations for the usual case: a document you want to query with simple XPath.
  3. To strip just one vocabulary, type its prefix into Only this prefix — everything else keeps its namespace.
  4. 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

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

Privacy

100% client-side. The document is rebuilt locally by your browser. See the privacy policy.