Developer Tools
Comment Stripper
Strip line and block comments from JavaScript, TypeScript, CSS, HTML, JSON, SQL, Python, YAML, Shell, and more. Strings and templates stay intact.
Language
Each language uses a string-aware tokenizer, so a comment-like sequence inside a string literal is preserved.
Options
Stripped output
Output appears here as you type.0 chars, 0 lines. No comments removed yet.
Input chars
0
0 lines
Output chars
0
0 lines
Characters removed
0
0.0% reduction
How to use
- Pick the language of your source code from the language grid. Each option lists the comment styles it understands.
- Paste your code into the input area. Click Load sample to see a worked example for the selected language.
- Toggle Strip line comments and Strip block comments to control which kinds of comments are removed.
- Toggle Collapse blank lines and Trim trailing whitespace to clean up the blank lines and dangling spaces left behind by removed comments.
- Click Copy on the output to copy the stripped result to the clipboard. The character-count summary shows how much was removed.
About this tool
Comment Stripper removes line and block comments from source code across 13 language families using string-aware tokenizers, so a comment-like sequence that appears inside a string literal is preserved instead of being deleted. Supported languages include JavaScript and TypeScript (with template literals, interpolations, and regex literals), C-family languages (C, C++, Java, Go, Rust, C#, Swift, Kotlin), CSS, SCSS and LESS, HTML, XML and SVG, JSON, JSONC and JSON5, SQL, Python (with triple-quoted strings and docstrings preserved), Shell and Bash, YAML and TOML, Ruby, Perl, R, and Lua (including the long-bracket comment syntax). Choose whether to strip line comments, block comments, or both. Optional cleanup steps collapse runs of 3 or more consecutive blank lines (a common artifact of removing block comments) and trim trailing whitespace at the end of each line. The tool reports input and output character counts and the percentage reduction so you can confirm the result. Useful for converting JSONC or JSON5 to plain JSON before a parser that does not allow comments, sanitizing snippets before publishing them, stripping internal TODOs and review notes from a paste, and producing a smaller minify-ready source file. All processing runs locally in your browser; the source code never leaves the device.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON Formatter
Format, minify, and validate JSON in your browser.
Open tool
DeveloperJSON Repair
Auto-fix broken JSON: trailing commas, single quotes, unquoted keys, comments, smart quotes, and NDJSON.
Open tool
DeveloperCSS Formatter
Beautify minified CSS with indent, brace style, and sort options.
Open tool
DeveloperHTML Formatter
Pretty-print and minify HTML with indent, wrap, and quote controls.
Open tool
DeveloperSQL Formatter
Pretty print SQL with configurable keyword case, indent, and comma style.
Open tool
DeveloperJSON Minifier
Compact JSON with live byte savings and a JS literal copy.
Open tool