Remove HTML Comments

Remove comments from HTML online: paste your code or open a file, then copy it back clean.

or open an .html file or drop one here

 
Keep conditional comments
Remove the empty lines they leave

Remove HTML Comments Online

Paste your HTML into the box on the left, or open an .html file, and the same code appears on the right with every comment removed. Tap the result to copy all of it, or press Download to save it as a file. This HTML comment remover is for the moments before code goes somewhere public: notes to yourself, commented-out blocks, old navigation, TODOs and version stamps that visitors can read with View Source, and that add weight to every page load.

It Knows Which Comments Are Real

A simple find-and-replace for <!-- breaks pages, because that text also turns up where it is not a comment. The tool reads the code the way a browser does, so it strips comments from the markup and leaves everything else exactly as you wrote it:

A comment that is never closed hides the rest of the page in a browser. Rather than guess where it should end, the tool leaves it in place and tells you the line it starts on, so no code after it is lost.

Conditional Comments for Outlook and Old IE

HTML emails depend on <!--[if mso]> blocks to lay out in Outlook, and older sites load fixes through <!--[if lt IE 9]>. They look like comments but they are code, so Keep conditional comments is on by default. Turn it off to remove them as well; the content between the <!--[if !IE]><!--> markers stays either way, because every browser shows it.

Clean Lines, Not Just Clean Code

A comment on a line of its own leaves an empty line behind when it goes. With Remove the empty lines they leave on, those lines disappear with their indentation, while the blank lines you put in on purpose stay where they were. Turn it off to keep the line count identical to the original, which is handy when you compare the two versions side by side. Removing comments is only part of making a page faster; for the pictures on it, Compress Image shrinks them in the same way, in your browser.

Frequently Asked Questions About Removing HTML Comments

Does it remove CSS or JavaScript comments?

No. Comments inside style and script blocks are part of that CSS or JavaScript code and follow different rules, so the tool leaves both blocks untouched. It removes HTML comments only.

Will removing comments change how my page looks?

No. Browsers never display HTML comments, so the page renders the same. The one exception is conditional comments, which is why they are kept unless you switch that off.

Can I clean a whole file?

Yes. Open or drop an .html, .htm or .php file and the cleaned version downloads with the same extension and "-no-comments" added to the name.

Is my code uploaded anywhere?

No. The code is processed by the page itself in your browser, so unreleased markup, internal notes and client work never leave your computer.