Remove HTML Comments Online

Clean up your HTML code by stripping out comment blocks while keeping your actual code intact

How to Use This Tool

  1. Paste your HTML code - Insert any HTML content containing comments
  2. Choose options:
    • Keep conditional comments: Preserve browser-specific conditional comments
    • Remove empty lines: Clean up blank lines left after comment removal
  3. Click "Remove Comments" - Get clean HTML without comments instantly
  4. Copy, download or edit - Use the cleaned code however you need

What Are HTML Comments?

HTML comments are sections of code that are ignored by web browsers. They're useful for:

  • Adding notes and explanations to your code
  • Temporarily disabling code without deleting it
  • Leaving instructions for other developers

Comments are wrapped between <!-- and --> markers.

Common Comment Types:

Single-line comment:
<!-- This is a comment -->
Multi-line comment:
<!--
  This is a multi-line
  comment block
-->
Conditional comment (IE-specific):
<!--[if IE]>Special content for IE<![endif]-->

Common Use Cases

  • Clean production code by removing developer notes
  • Reduce file size by stripping unnecessary comments
  • Prepare code for minification or obfuscation
  • Remove commented-out code that is no longer needed
  • Clean up templates before deployment

Example Transformation

Before (With Comments)After (Comments Removed)
<!DOCTYPE html>
<html>
<head>
    <!-- Page title -->
    <title>Example Page</title>
    <!-- Styles will go here -->
    <style>
        /* CSS content */
    </style>
</head>
<body>
    <!-- Header section -->
    <header>
        <h1>Welcome</h1>
    </header>

    <!--[if IE]>
        <p>Special message for IE users</p>
    <![endif]-->

    <!-- Main content -->
    <main>
        <p>Page content here</p>
        <!-- <p>This is commented out</p> -->
    </main>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Example Page</title>
    <style>
        /* CSS content */
    </style>
</head>
<body>
    <header>
        <h1>Welcome</h1>
    </header>

    <!--[if IE]>
        <p>Special message for IE users</p>
    <![endif]-->

    <main>
        <p>Page content here</p>
    </main>
</body>
</html>