</> HTML · CLEANER

HTML Comment Remover

Strip every <!-- comment --> from your HTML without breaking the page. Text that only looks like a comment — inside a <script>, a <style>, a <textarea> or an attribute value — is left exactly as it is.

HTML-parser rules · Scripts & styles protected · Conditional & licence comments optional
Tip: comments are visible to anyone who opens View Source — remove notes, old code and internal URLs before publishing.Want to shrink the whole file? HTML Minifier →
HTML HTML
HTML without comments
Comments removed: –
Kept: –
Saved: –
Time: –
HTML Living Standard tokenizer rules · 100% Client-Side
◆ ABOUT THIS TOOL

Why Remove HTML Comments?

Comments are invisible on the page — but not in the source.

HTML comments (<!-- … -->) are notes for developers. Browsers don't display them, but they're still downloaded and anyone can read them with View Source. Old code, TODO notes, internal URLs and build information often end up there.

Removing them makes pages a little smaller and keeps internal details private. Unlike a simple search-and-replace, this tool reads HTML the way a browser does, so it only removes real comments.

What's protected. Inside <script> and <style> (and <textarea>, <title>, <xmp>, <iframe>, <noembed>, <noframes>), <!-- is just text — removing it could break JavaScript or CSS. The same goes for attribute values like title="<!-- -->", <![CDATA[ … ]]> blocks and <!DOCTYPE>.

Unclosed comments. A <!-- without a closing --> hides everything after it in a browser. The tool doesn't delete the rest of your document — it leaves that part unchanged and tells you the line number so you can fix it.

⌘ REFERENCE

Comment Forms the Tool Understands

All of these follow the HTML standard.

FormWhat it isRemoved?
<!-- note -->Normal comment (may span lines)Yes
<!---->, <!-->, <!--->Empty commentsYes
<!-- a --!>Comment closed with --!> (browsers accept it)Yes
<!--[if IE]> … <![endif]-->IE conditional commentYes, unless “Keep IE conditional comments”
<!--! licence -->“Important” comment conventionYes, unless “Keep <!--! … -->”
<script>// <!-- … --></script>Script text, not a commentNever
<!DOCTYPE html>, <![CDATA[ … ]]>Not commentsNever
◐ THREE STEPS

How to Use the HTML Comment Remover

Get your result in under ten seconds.

1

Paste your HTML

A snippet, a template or a whole page — or open a file.

2

Choose what to keep

IE conditional comments and <!--! licence comments are optional.

3

Copy the clean HTML

Everything except the comments is byte-for-byte unchanged.

✓ FEATURES

Why Use the HTML Comment Remover on Developers Web Tools

Fast, accurate and private — built for developers.

🛡

Never breaks code

Scripts, styles, textareas and attribute values are skipped exactly like a browser does.

≡

Standard-exact

Handles <!-->, <!---> and --!> endings defined by the HTML standard.

⚙

Selective

Keep IE conditional comments or <!--! licence notes if you need them.

Tidy output

Lines that held only a comment are removed, not left blank.

⚠

Unclosed comments

Reported with a line number instead of swallowing the rest of the page.

🔒

Private

Your markup never leaves the browser.

FAQ

Frequently Asked Questions

No. <!-- inside <script> and <style> isn't an HTML comment, so it's left alone. The tool also skips attribute values, <textarea> and <title> content. Only real HTML comments are removed.

No — those are JavaScript and CSS comments. Removing them safely needs a JavaScript or CSS parser; use the CSS Minifier (and the upcoming JavaScript Minifier) for that.

Usually not. Only Internet Explorer 5–9 read them, and those browsers are long retired. Keep them only if you still support very old IE.

In a browser, an unclosed <!-- hides everything after it. The tool leaves that part of your document unchanged and shows the line number, so you can add the missing -->.

No. Apart from removed comments (and, if enabled, the empty lines they leave), the output is identical to your input.

No. Everything runs in your browser.