Strip comment

Remove language-style comments from source text while optionally retaining JSDoc.

freeworks offlinenothing uploaded
ToolComment Stripper
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The selected language supplies line and block delimiters, optional JSDoc blocks are preserved, and matching spans are removed before the remaining source is joined. This is delimiter-based text processing rather than a complete lexer.

  • Auto detection covers common source languages.
  • JSDoc preservation defaults on for API documentation.

Worked example

Strip JavaScript comments
Remove single-line and block comments from JS code
Input
											// Initialize counter
let count = 0;
/* Increment
   the counter */
count++;
										
Output
												
let count = 0;

count++;
											

When to use this

Minification pre-passes, generated fixtures, and source documentation reviews strip comments.

Edge cases

  • A marker inside a string can be removed by the simple pass.
  • SQL -- and Python # depend on selected language.
  • JSDoc remains when preservation is enabled.