SQL Comment Remover

Strip line (--) and block (/* */) comments from SQL while keeping your query formatting.

Loading tool…

Remove comments from SQL

The SQL Comment Remover strips both line comments (-- ...) and block comments (/* ... */) from your SQL while preserving the query's formatting and line structure. Paste your SQL and copy the clean, comment-free result — all in your browser, instantly and privately.

Why remove SQL comments?

Comments are great during development, but sometimes you want them gone: before sharing a query publicly, when comments contain internal notes or credentials hints, when preparing SQL for logging, or simply to declutter a query for review. Removing them by hand across a long script is tedious — this tool does it in one step.

What it removes

  • Line comments — everything after -- on a line.
  • Block comments — anything between /* and */, even across multiple lines.
  • Trailing whitespace left behind, and excessive blank lines.

How to use it

  1. Paste your SQL into the box.
  2. The comment-free version appears below.
  3. Copy the cleaned SQL.

Formatting is preserved

KeptRemoved
Indentation and line breaks-- line comments
Your query structure/* block comments */
String literalsTrailing spaces & extra blank lines

Unlike a minifier, this tool leaves your query readable — it only strips the comments, so the SQL stays formatted the way you wrote it.

Tip

If you also want the query on a single compact line, run the result through the SQL minifier afterward. Keep your original commented version somewhere safe, since removing comments is not reversible.

Private and free

Your SQL is processed entirely in your browser. Nothing is uploaded or stored, and the tool is completely free.

Frequently asked questions

What comments does it remove?

Both line comments starting with -- and block comments wrapped in /* */, including multi-line block comments.

Does it keep my formatting?

Yes. Unlike a minifier, it preserves indentation and line breaks — it only strips the comments.

Is it reversible?

No. Removing comments cannot be undone, so keep a copy of your original commented SQL.

Is my SQL private?

Yes. Everything runs in your browser and nothing is uploaded or stored.