Azlaan Electric AC Solar Center — Solar, CCTV, AC & electrical work, Faisalabad Call: 0300-8987448

Code Comment Stripper

Paste code, pick a language, and remove comments safely. A string-aware tokenizer keeps // and # text inside quotes intact, so URLs and messages are never damaged. Runs 100% in your browser — your code is never uploaded.

Input
What to remove
Try a sample:
Cleaned code

                
How to use it
  1. Paste your code and choose the matching language so the tokenizer knows the comment style.
  2. Choose the options: remove every comment or only single-line ones, keep documentation blocks, and optionally preserve line numbers for error traces.
  3. Press Strip comments — the stats line shows lines before/after, how many comments were removed, and bytes saved.
  4. Copy or download the cleaned code. Tip: one known edge case is JavaScript regular-expression literals (like /a+b/) — check those lines after stripping.
Frequently asked questions

Will it delete comment-like text inside my strings?

No. The tool uses a small state-machine tokenizer that tracks string literals, including single quotes, double quotes, backticks and Python triple quotes. Text like https://example.com inside a string is never treated as a comment, so URLs and messages survive stripping untouched.

What is the difference between a docblock and a normal comment?

A docblock is a structured documentation comment, such as /** ... */ in JavaScript, PHP and CSS or a triple-quoted docstring in Python. Documentation generators and IDEs read them to build API docs and tooltips, which is why the tool offers a keep-docblocks option that removes ordinary comments but preserves documentation.

Why would I preserve line numbers?

Error messages, stack traces and log files refer to line numbers. If stripping deletes whole lines, every line below a removed comment shifts up and your old error reports point at the wrong code. The preserve option replaces removed comments with blank lines so numbering stays identical.

Does my code leave my browser?

No. All stripping happens locally in your browser with JavaScript. Nothing is uploaded, stored or sent to any server, so private or proprietary code stays on your own machine.