TextArray
100% local

SQL comment remover

Strip -- line comments and /* */ block comments from SQL without touching string literals.

Input
Output

SQL comment remover

Paste an SQL script and this tool strips the comments out: -- line comments to the end of the line and /* */ block comments wherever they appear, including blocks that span several lines. Use it to clean up a schema dump before sharing it, shrink a migration before committing it, or remove internal notes from a query you are about to send to a client or paste into a ticket.

Unlike a naive find-and-replace, the tool actually tokenizes the SQL. Single-quoted strings (including the doubled '' escape), double-quoted identifiers and MySQL backtick identifiers are copied through untouched, so a value like '-- not a comment' or a column named "a--b" survives exactly as written. The remove selector limits the cleanup to line comments only or block comments only when you need just one kind gone.

Two options control the details. Keep marked comments preserves any comment that starts with a marker — with the default ! that means --! annotations and MySQL executable hints like /*!40101 ... */ stay in place, which matters when a dump relies on them. Drop emptied lines removes lines that held nothing but a comment, so a heavily annotated script does not turn into a ladder of blank lines; existing blank lines are always kept.

Everything runs locally in your browser — your SQL is never uploaded, so schemas, table names and data in string literals stay on your machine. The tally under the output shows how many comments were removed and how many bytes you saved.

FAQ

Will it break strings that contain -- or /*?
No. The tool tokenizes the SQL instead of using a blind regex, so '-- like this' inside single quotes, double-quoted identifiers and backtick names pass through unchanged.
Can I keep MySQL executable comments?
Yes. Turn on "Keep marked comments" — with the default marker ! every comment starting with it survives, including /*!40101 ... */ hints and --! annotations.
What happens to lines that only contained a comment?
With "Drop emptied lines" on (the default) they are removed entirely. Blank lines that were already in the script are never touched.
Are # comments removed too?
No. The # style is MySQL-specific and ambiguous in other dialects, so the tool only handles the standard -- and /* */ forms.
Is my SQL uploaded anywhere?
No. The tool runs entirely in your browser and your script never leaves your device.