Remove Comments From Code

Paste your code and instantly strip every comment — // line comments, /* block comments */, # hash comments and <!-- HTML comments --> — from JavaScript, TypeScript, Python, Java, C, C++, C#, PHP, HTML, CSS, SQL and 25+ languages. It runs entirely in your browser, so your code is never uploaded — no sign up, no watermark, completely free.

✓ 100% free ✓ No sign up ✓ Runs in your browser ✓ Nothing uploaded ✓ 25+ languages
Your code (with comments)
Result (comments removed)

How to remove comments from code

1

Paste your code

Copy your source file and paste it into the input box on the left. Any size works — a small snippet or a whole file.

2

Pick the language

Choose your programming language so the tool uses the right comment rules, or leave it on Auto-detect and it will guess for you.

3

Remove the comments

Click Remove comments. Every real comment is stripped instantly while your strings, URLs, regex and docstrings stay exactly as they were.

4

Copy or download

Copy the clean code to your clipboard or download it as a file. See how many characters and lines you saved.

Remove comments from any programming language

This free comment remover understands the comment syntax of every major language, so it strips the right thing without touching your code. Whether you need to Remove comments from JavaScript, Remove comments from TypeScript, Remove comments from Python, Remove comments from Java, Remove comments from C and C++, Remove comments from C# or more, just pick the language and go:

Remove comments from JavaScript Remove comments from TypeScript Remove comments from Python Remove comments from Java Remove comments from C and C++ Remove comments from C# Remove comments from PHP Remove comments from HTML Remove comments from CSS Remove comments from SQL Remove comments from Go Remove comments from Ruby Remove comments from Rust Remove comments from Shell scripts Remove comments from JSON with comments

Every comment type it removes

The tool is comment-aware. It removes real comments while keeping strings, URLs, regular expressions and Python docstrings safe — so it will never corrupt your source code.

Line comments
// … and # … and -- …

Single-line comments in JavaScript, C, Java, PHP, Python, Ruby, Shell, SQL and more.

Block comments
/* … */

Multi-line C-style block comments used by JavaScript, CSS, Java, C, C++, C#, PHP and SQL.

HTML / XML comments
<!-- … -->

Markup comments in HTML, XML, Vue and Svelte templates.

Docstrings & strings
"""…""" `…` '…'

Kept safe — the tool never removes strings, template literals, regex or Python docstrings.

What you can do by removing comments from code

Stripping comments is a quick way to clean up, shrink and share source files. Here are the most popular reasons developers use this online comment remover:

Ship cleaner production code

Strip developer notes and TODOs from source files before you deploy, publish or hand code to a client.

Shrink and minify files

Remove comments as a first step to reduce file size before minifying JavaScript, CSS or HTML.

Share clean snippets

Paste code into Stack Overflow, GitHub issues, docs or chat without your private // comments coming along for the ride.

Clean up generated code

Boilerplate and scaffolded files are full of comments — remove them all in one click to see just the logic.

Review the real logic

Hide the noise and read what the code actually does by stripping every explanatory comment at once.

Prepare code for teaching

Give students an uncommented version of a file as an exercise, then compare it with the commented original.

Why use this comment remover

🆓

Free & unlimited

Remove comments from as much code as you want, as often as you want — no limits, no trial, no credit card.

🔒

100% private

Everything runs in your browser. Your code is never uploaded, stored or seen — safe for proprietary and client code.

🧠

Won't break your code

It understands strings, URLs, regex and docstrings, so a // or /* inside them is never mistaken for a comment.

🌐

25+ languages

JavaScript, TypeScript, Python, Java, C, C++, C#, Go, Rust, PHP, HTML, CSS, SQL, Shell and more.

🧹

Extra clean-up

Optionally remove the blank lines and trailing whitespace that stripped comments leave behind.

Instant

No sign up and no upload wait — paste, click, and copy your clean code in a second.

Tips for removing comments

  • Choose the exact language when you can — it gives the most accurate result, especially for PHP (# and //) and SQL (--).
  • Turn on "Remove blank lines" to collapse the gaps that removed comments leave behind for tidy, compact code.
  • Removing comments does not reformat your code — combine it with a formatter or minifier for a full clean-up.
  • Keep an original copy of your file; comments often carry licence headers and documentation you may want to keep.
  • Your code stays in your browser, so this tool is safe for confidential, proprietary and client source code.

How this comment remover compares

FeatureThis toolTypical comment removers
Price Free forever Free / limited
Sign up / account Never required Sometimes required
Runs in your browser (no upload) Yes — code stays private Often uploaded to a server
Understands strings, URLs & regex Yes — won't corrupt code Often naive find-and-replace
Languages supported 25+ languages A handful
Remove blank lines & trailing space Built in Rarely
Software to install None None / extension

Who uses this tool

Anyone who works with source code and wants a fast, private way to strip comments:

Front-end & back-end developers Students & coding beginners Open-source maintainers DevOps & data engineers Technical writers Anyone sharing code online

Frequently asked questions

Is this comment remover really free?

Yes. Removing comments from your code is 100% free with no limits, no trial and no credit card. Paste as much code as you like, as many times as you like, and remove every comment for free.

Do I need to sign up or install anything?

No. There is no sign up, no account and no software to download. Open the page, paste your code, choose the language and click Remove comments — that is it.

Is my code uploaded to a server?

No. This is the big difference: the whole tool runs inside your browser with JavaScript. Your source code is never sent to any server, never stored and never seen by anyone. It is completely private, which makes it safe to use even for proprietary or client code.

Which programming languages are supported?

The comment remover works with JavaScript, TypeScript, JSX, Java, C, C++, C#, Go, Rust, Swift, Kotlin, Dart, PHP, Python, Ruby, HTML, XML, CSS, SCSS, Sass, LESS, SQL, Shell/Bash, YAML, Dockerfile and Lua. It understands each language's own comment syntax.

What types of comments can it remove?

It removes single-line comments (// and # and --), multi-line block comments (/* … */), HTML/XML comments (<!-- … -->) and language block comments such as Lua's --[[ … ]]. You can choose to remove line comments, block comments, or both.

Will it break my code or delete the wrong thing?

No. The tool is comment-aware, not a blind find-and-replace. It understands strings and knows that a // or /* inside a string, a URL like "https://example.com", a regular expression, or a Python docstring is not a comment, so it leaves them untouched. Only real comments are removed.

Does it keep URLs like https:// safe?

Yes. A common problem with naive comment removers is that they delete everything after https:// because of the //. This tool detects that the // is inside a string or a value and never treats it as a comment, so your URLs stay intact.

Can it also remove blank lines left behind?

Yes. There is a "Remove blank lines" option that collapses the empty lines a removed comment leaves behind, plus a "Trim trailing whitespace" option — so you get clean, compact code, not a file full of gaps.

Does removing comments make my file smaller?

Yes. Stripping comments reduces the size of your source file, which is useful before shipping to production, minifying, or pasting code into a documentation, chat or bug report. The tool shows you exactly how many characters and lines it removed.

Can I remove comments from JavaScript and keep the strings?

Absolutely. That is exactly what it does. It parses JavaScript (and TypeScript) properly, so template literals, regex literals and quoted strings that contain // or /* are preserved while the actual comments are removed.

How do I remove comments from Python code?

Choose Python from the language menu and paste your code. Every # comment is removed, while triple-quoted docstrings and any # inside a string are correctly kept, because they are strings, not comments.

How do I remove HTML or CSS comments?

Pick HTML/XML to strip every <!-- … --> comment, or pick CSS to strip every /* … */ comment. In CSS the tool is careful not to touch // inside url(http://…) values.

Can I use it on mobile?

Yes. It works in any modern browser on Android, iPhone, iPad, Windows, Mac and Linux — no app required. Paste your code, tap Remove comments and copy the clean result.

Is there a limit on how much code I can paste?

There is no fixed limit. Because the processing happens on your own device, you can clean small snippets or very large files — performance depends on your device, not on any server quota.

How is this better than removecomments.net or commentclean.com?

This tool supports more languages, understands strings, regex and docstrings so it will not corrupt your code, keeps everything private in your browser with no upload, and adds extra clean-up options like removing blank lines and trailing whitespace — all free and with no sign up.