Code · Made a little simpler

XML Comment Remover

Remove XML comments in your browser while preserving other source text. Keep CDATA and processing instructions, validate the result and download clean XML.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

XML Comment Remover: how to use it

  1. Paste XML or choose a valid UTF-8 document.
  2. Select Remove comments. The tool checks the input and parses the result again.
  3. Compare the preview with the source and download without-comments.xml.

Limits and notes

Local files must be UTF-8 and at most 4 MiB. XML input supports up to one million UTF-16 code units, 100,000 nodes and 128 element levels. DTDs are excluded. Retains other markup, line endings and comment-like text inside CDATA or processing instructions. Parsing must succeed before a result is offered.

How your privacy works →

XML Comment Remover: common questions

Does the tool remove comment markers inside CDATA?

No. CDATA is a text node type and may contain the literal characters <!-- and -->. The remover retains them.

Will deleting a comment add a space between two words?

No space is inserted. In a<!-- note -->b, the two text pieces become ab after the comment is removed.

Guides