Online Tool Store Online Tool Store

Code Comment Stripper

Paste code to remove line and block comments while keeping formatting and strings intact. Runs entirely in your browser.

🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.

Comments removed

function add(a, b) {
  return a + b;
}

Example shown — replace it with your own code to strip.

How it works

  1. Paste code containing comments.
  2. Line and block comments are detected and removed.
  3. Copy the cleaned result.

Stripping tokenizes the source, distinguishing string literals from real comment syntax, then removes every recognized //, /* */, or # comment while leaving the rest of the code untouched.

FAQ

Is my code uploaded anywhere?

No. Stripping happens entirely in your browser — your code is never sent to a server.

Which languages are supported?

C-style languages (JavaScript, TypeScript, Java, C/C++, CSS) using // and /* */ comments, plus Python and shell-style # comments.

Does it strip comments inside strings?

No — the stripper recognizes string literals and leaves comment-like text inside quotes untouched, so it won't corrupt a URL or string containing //.

Does it change indentation or formatting?

No — only comment text is removed. Everything else, including whitespace, stays exactly as you pasted it.

How we compare

Feature Online Tool Store Manual find-and-replace Minifier (strips everything)
Keeps formatting and whitespaceRisk of breaking strings with //Also removes formatting
Free, no setup

A minifier strips comments but also collapses formatting. Code Comment Stripper removes only the comments, keeping the code readable.

Explore related tools

Embed this tool

Paste this on your own site — it stays free, and every file still stays in your visitor's browser, not yours or ours.