Comment Remover
Free online comment remover tool, no installation required
About Comment Remover
Strip comments from JavaScript, CSS, HTML, or Python source while preserving string literals, template literals, regex literals, and (optionally) URLs found inside comments. The tool reports how many comment blocks were removed and outputs the cleaned code with a copy button.
How to Use
1. Paste code into the Code Input textarea. 2. Choose a Language: JavaScript, CSS, HTML, Python, or Auto Detect. 3. Toggle Preserve URLs to keep any http(s):// URLs found inside removed comments. 4. Click Remove Comments. The output panel shows the cleaned code plus a count of comments removed.
Per-Language Removal Rules
JavaScript: removes // line comments and /* */ block comments, while tracking ", ', and ` string literals and /.../ regex literals so comment markers inside them are safe. CSS: removes /* */ blocks. HTML: removes <!-- --> comments. Python: removes # comments per line, respecting single, double, and triple-quoted strings. Auto Detect picks HTML for <!--, Python for def/import/class/from/#, CSS for brace-semicolon patterns, otherwise JavaScript.
▶How does Auto Detect choose a language?
▶What does Preserve URLs do exactly?
▶Are strings and regexes protected?
▶What is the removed-comments count based on?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee