CodeScript

SQL Minifier

Collapse whitespace in SQL queries to compress them.

What it does

Removes unnecessary whitespace and line breaks from a SQL query, while carefully preserving spacing inside string literals ('...', "...") and comments (--, #, /* */) so the query's meaning doesn't change.

Common errors

  • Escaped quotes inside strings

    A doubled quote ('') inside a string literal represents an escaped quote, not the end of the string — this tool accounts for that when scanning.

FAQ

No — only whitespace outside of strings and comments is collapsed. The query's logic is unchanged.

Related tools