Local StudioDEVELOPER TOOLS

Code Comment Stripper

Blank ordinary JavaScript comments while keeping source positions, literals and recognized notices intact.

  • Free
  • Works Offline
  • No Uploads
Works with:
  • Microsoft Edge
  • Google Chrome
  • Mozilla Firefox
  • Safari
Code Comment Stripper showing the result totals and JavaScript containing a hashbang, a license notice, a URL and a regular expression.
The sample keeps the hashbang and license notice. Its regular expression and URL string remain intact.

How to Remove Code Comments

  1. Open the HTML, review Security Check, then select Continue.
  2. Paste JavaScript source, open a UTF-8 .js, .mjs or .cjs file up to 1 MiB, or choose Open Sample.
  3. Choose Auto Detect, Script or Module. Select Strip Comments. Ordinary comments become spaces and marked notices and recognized pragmas stay in place.
  4. Review the counts and cleaned source. Choose Copy JavaScript or Download JavaScript to keep the full result.

Keep Code and Source Positions Intact

  • Blank ordinary comments while keeping line and column positions.
  • Retain marked licenses and recognized directives such as source-map and TypeScript check comments.
  • Review source-located diagnostics before retrying.

Formats and Compatibility

InputPaste JavaScript or choose one UTF-8 .js, .mjs or .cjs file up to 1 MiB. Choose Auto Detect, Script or Module.
OutputReview the counts and cleaned text, then copy or download a UTF-8 JavaScript file.
BrowserA modern browser with local file support.
ScopeProcess one UTF-8 JavaScript .js, .mjs or .cjs file up to 1 MiB, or paste source. Script and Module use plain JavaScript syntax.
Operating Systems
  • Windows
  • macOS
  • Linux
  • ChromeOS

Local Processing Without Uploads

Remove code comments without uploading files. The browser-based tool has no upload and works offline on your device.

Select Open Sample to see the workflow with the included example.

JavaScript Script and Module

The tool identifies comments through a JavaScript parser. Strings, templates, regular expressions, line endings and the hashbang stay in place. TypeScript and JSX are outside this tool's scope.

Review and Save the Cleaned Source

For example, the sample keeps its marked license and a URL string. Replacing ordinary comments with spaces keeps UTF-16 positions stable. Removing a comment containing Unicode can change byte offsets.

Frequently Asked Questions

How can I remove code comments offline?

Use the Remove Code Comments download, extract the ZIP, and open CodeCommentStripper.html. The free Remove Code Comments tool includes a sample.

Can I remove code comments in browser?

Yes. The local Remove Code Comments workbench uses a JavaScript parser on your device.

Can I remove code comments online?

Open the hosted Remove Code Comments browser tool. It runs the same transformation on your device.

Which notices stay in place?

The tool retains marked license and copyright notices, SPDX identifiers, and recognized pragmas for source maps, linting, formatting, coverage, bundling and TypeScript check directives. Other project-specific annotations may be blanked.

How are Script and Module selected?

Auto Detect treats .mjs files as modules and .cjs files as scripts. Pasted or .js source with static import or export declarations is generally detected as a module. Choose Module explicitly for syntax whose mode is ambiguous.

What does blanking preserve?

It preserves line endings and UTF-16 offsets. The downloaded byte length can change if removed comments contain multibyte text. Files with CRLF keep those endings until you edit the text in the browser.

Does this tool work offline on Windows, macOS, Linux, and ChromeOS?

Yes. Local Studio tools run offline on Windows, macOS, Linux, and ChromeOS. Download the tool ZIP, extract it, and open the included HTML file in a supported browser. Your files are processed on your device without uploads.

Which browsers can I use with this offline tool?

Use a current version of Google Chrome, Microsoft Edge, Mozilla Firefox, or Safari where that browser is available for your operating system. Chrome is built into ChromeOS, and Safari is available on macOS.