SQL Minifier

Squeeze a formatted query onto one line — for embedding in code, logs, environment variables or a URL — without touching strings or quoted names.

Input · drop a file

Output

What the SQL minifier removes

  • -- line comments and /* … */ block comments.
  • Line breaks, tabs and repeated spaces, collapsed to a single space.
  • Spaces around ( ) , ; = < > + * /.

Anything inside single quotes, double quotes, backticks or square brackets is copied exactly, so 'ready for pickup' keeps its two spaces. Press Beautify to expand it again with the SQL formatter’s rules.

Questions

Does minifying make SQL run faster?

No. Databases ignore whitespace and comments when they parse a query. Minify to save space or to fit a query on one line.

Are MySQL # comments removed?

Not automatically, because # means other things in some dialects. Format with the MySQL formatter first if you need them gone.

Related tools