SQL Minifier

Compress SQL by removing comments and whitespace into a single line — with size savings.

Loading tool…

Minify your SQL instantly

The SQL Minifier compresses SQL by stripping comments and collapsing extra whitespace into a single, compact line — without changing what the query does. Paste your SQL and get a minified version plus the size savings, ready to copy. It runs entirely in your browser, so even large scripts are processed instantly and privately.

Why minify SQL?

Minified SQL is useful when you need to embed a query in a single line — in a config file, a log entry, a JSON payload, a connection string, or application code where multi-line strings are awkward. It also reduces the size of stored queries. Because minification only removes comments and whitespace, the query runs exactly the same.

What it removes

RemovedExample
Line comments-- like this
Block comments/* like this */
Line breaks & indentationMulti-line becomes one line
Extra spacesAround commas, parentheses, semicolons

How to use it

  1. Paste your SQL into the box.
  2. The minified version and size savings appear instantly.
  3. Click Copy minified to grab the result.

Keep a readable copy

Always minify a copy rather than your working query. Develop and store your SQL formatted and commented so it stays maintainable, then minify only when you need the compact form for embedding or logging. Pair this with a SQL formatter to switch back and forth as needed.

A note on string literals

Minifiers work on the structure around your SQL, not the data inside quoted strings. If your query contains string literals that include comment-like sequences, review the output to be safe. For typical queries, the minifier produces clean, correct single-line SQL every time.

Private and free

Your SQL is processed entirely in your browser — nothing is uploaded or stored. The tool is completely free with no limits.

Frequently asked questions

Does minifying change my query?

No. It only removes comments and whitespace. The minified SQL executes exactly the same as the original.

Why would I minify SQL?

To embed a query on a single line in config files, logs, JSON, or code where multi-line strings are inconvenient.

Does it remove comments?

Yes, both line comments (--) and block comments (/* */) are removed.

Is my SQL private?

Yes. Everything runs in your browser and nothing is uploaded or stored.