Clean up your HTML code by stripping out comment blocks while keeping your actual code intact
Keep conditional comments
: Preserve browser-specific conditional commentsRemove empty lines
: Clean up blank lines left after comment removalHTML comments are sections of code that are ignored by web browsers. They're useful for:
Comments are wrapped between <!--
and -->
markers.
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> |
Common Comment Types:
<!-- This is a comment -->
<!--
This is a multi-line
comment block
-->
<!--[if IE]>Special content for IE<![endif]-->