Skip to content
100% local

Remove HTML comments

Strip developer comments from HTML or XML markup before you publish it.

Input

Remove HTML comments

Developer notes, TODO reminders and commented-out blocks are useful while you build a page, but they have no business in the version you publish. HTML comments ship to every visitor and are visible to anyone who opens view-source, so a leftover note about a hidden discount, an internal URL or an unfinished feature is public the moment you deploy. Paste your markup here and every <!-- … --> comment is removed in one pass, leaving the rest of the document intact.

Two options cover the common edge cases. "Keep IE conditional comments" preserves <!--[if …]> … <![endif]--> blocks, including the downlevel-revealed pair — these are not notes but markup switches that some HTML email templates still rely on, because older Outlook versions read them. "Remove emptied lines" drops a line that held nothing but a comment, so the cleaned file does not end up riddled with blank lines; lines that were already blank in your input are left alone.

The tool works with plain pattern matching, not a full HTML parser. That makes it fast and predictable, but it also means comments inside <script> and <style> blocks are treated like any other markup and removed. An unclosed <!-- runs to the end of the input, which mirrors what a browser renders in that case. Windows and Unix line endings are both handled.

Everything runs locally in your browser. Your markup is never uploaded, so cleaning a CMS export, a client's e-shop product feed or an unreleased email template is safe. The tally under the output shows how many comments were removed and how many bytes you saved; copy the result or download it when you are done.

FAQ

Is my HTML uploaded anywhere?
No. Comment removal runs in your browser without uploading anything. Whether cleaning a CMS export, client template or internal markup, your HTML stays on your device.
Are comments inside <script> and <style> removed too?
Yes. The tool matches the <!-- … --> pattern anywhere in the text — it is a pattern matcher, not an HTML parser — so comments inside script and style blocks are removed like any other.
What happens to a comment that is never closed?
Everything from the opening <!-- to the end of the input is removed. A browser treats the rest of the document as one long comment in that case, so removing it mirrors what the browser actually renders.
Why would I keep IE conditional comments?
Blocks like <!--[if mso]> … <![endif]--> are markup switches, not notes. Some HTML email templates still use them because older Outlook versions read them, so turn the option on before cleaning an email template.