Comment Stripper
Remove comments from code — line, block or both — for JavaScript, CSS, Python, SQL, HTML and more, keeping strings intact and, if you want, doc comments.
The code without comments, with emptied lines dropped or kept, the count of comments removed and kept, and the line and character totals before and after.
Example: "// header", a trailing "// note", a two-line /* block */ and a /** doc */ → three removed, the doc kept, emptied lines gone: 10 lines become 7; "http://x.com" inside a string is untouched.
Comments out,
code untouched.
What is removed, what is kept on purpose, and what is left alone.
Removal
The same scanner as the Code Line Counter finds every comment by family — C-like, CSS, hash, SQL, HTML, Lua — skipping string literals, so a URL in a string survives. You can remove line comments only, block comments only, or both. An inline block comment between two spaces leaves a single space; a trailing comment takes the spaces before it with it.
Kept on purpose
With “keep doc & license” on, /** … */ doc comments, /*! … */ license banners and a #! shebang on the first line stay — minifiers keep the same ones. A block comment that spanned several lines keeps its line breaks unless “drop emptied lines” is on, so line numbers in stack traces still match when you want them to.
Left alone
Nothing else changes: no minification, no re-indentation, no reformatting. Comments inside <script> or <style> in an HTML file need the C or CSS family; comments inside template literals are string content and stay; JavaScript regex literals are not parsed. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.
SOURCES
- Comment families: C-like, CSS, hash (#), SQL, HTML, Lua; string literals skipped; /** … */, /*! … */ and #! shebang treated as doc comments; no minification or re-indentation
Last reviewed 21 September 2026. How results are checked: How we verify.