SQL Minifier

Strip extra spaces, line breaks and comments from SQL to get short, compact queries.

0.30 KB

How SQL Minifier works

Makes SQL shorter by removing comments, line breaks and extra spaces. The query does the same thing, but it takes less space. Useful when you put SQL in code, config files or logs.

Both -- line comments and /* block */ comments are removed. Spaces around commas, brackets and operators like = are removed, and one space is added after each comma. Spaces inside text in single quotes are kept.

Input to SQL Minifier

  • Paste or type SQL into the input box, or upload or drop a .sql or .txt file.
  • Click Minify. The size of your input and output shows above each box, so you can see how much you saved.
  • If brackets or quotes are not balanced, you still get the output, with a warning to check it.

Output from SQL Minifier

  • SQL on one line, with syntax highlighting.
  • Copy it, download it as minified.sql or open it in full screen.
  • Use SQL Formatter to make minified SQL easy to read again.