JS Comment Remover — Free Online Tool

Remove line and block comments from JavaScript while preserving URLs and comment syntax inside strings, with optional JSDoc keep. JS Comment Remover is a free online tool from the ToolsRift JavaScript Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.

Loading JS Comment Remover

How to use JS Comment Remover

Paste your code, optionally enable Preserve JSDoc or Collapse blank lines, then click Remove Comments and copy the result.

Frequently asked questions

Does it strip // inside a URL string?

No. The scanner tracks string and regex literals, so // inside "http://example.com" or inside a regex is kept — only real comments outside strings are removed.

Can I keep JSDoc blocks?

Yes. Enable 'Preserve JSDoc' to keep /** ... */ documentation blocks while still removing ordinary /* */ and // comments.

What does Collapse blank lines do?

After comments are removed, empty leftover lines can remain. Enabling the option collapses those blank lines so the output stays compact.

More JavaScript Tools

JS Import Sorter
Sort and group ES module import statements alphabetically, separating external packages from internal relative imports
JavaScript Obfuscator
Basic JavaScript obfuscation with variable renaming and string encoding to protect code
ES6 to ES5 Converter
Convert modern ES6+ arrow functions and syntax to ES5-compatible JavaScript for legacy browsers
JS to TypeScript
Add TypeScript type annotations to JavaScript functions for better type safety and IDE support
Regex Tester
Real-time regular expression tester with match highlighting, groups, and detailed match information
JS Console Simulator
Simulate JavaScript console.log output for code snippets and preview execution results

← View all JavaScript Tools