SQL Minifier

Collapse a SQL query into a single line.

SQL input
Minified SQL

Free online SQL minifier. Collapse whitespace, newlines and comments to turn a multi-line SQL query into a single compact line — ideal for logging or embedding. Runs in your browser.

How to use the SQL Minifier

  1. 01Paste your multi-line SQL query.
  2. 02The minified single-line query appears instantly.
  3. 03Copy the compact result — string literals are preserved.

Frequently asked questions

Are string literals kept intact?

Yes. Whitespace inside quoted strings is preserved; only formatting whitespace, newlines and comments outside strings are collapsed.

Does it remove comments?

Yes — both line comments (--) and block comments (/* ... */) are stripped so the query fits on one line.