SQL

SQL Comment Remover

Strips line and block comments without disturbing comment characters inside string literals.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste the script containing the comments.
  2. Select Remove comments.
  3. Read the result before sharing it — check that nothing sensitive remains in the SQL itself.

What sql comment remover does

Removing comments from SQL sounds like a job for search and replace until you meet a string literal containing two hyphens, or a URL with a double slash inside quotes. This tool tokenises the statement first, so it can tell a real comment from a sequence of characters that merely looks like one.

The common reasons to strip comments are preparing a script for a tool that mishandles them, and removing internal notes before sharing a query outside your team. If the second reason applies, read the result before you send it: comments are not the only place a query can carry something private, since table names, literal values and column names often say a good deal on their own.

Frequently asked questions

It stays. The script is tokenised before comments are found, so characters inside a quoted literal are never mistaken for a comment marker. That is the case a plain search and replace gets wrong.

Yes — line comments beginning with two hyphens, and block comments between slash-star and star-slash, including ones that span several lines.

No. Comments are the obvious place to look, but table names, column names and literal values in the query itself often reveal just as much. Read the whole statement before you send it outside your team.