SQL Minify

Strip extra whitespace from SQL while keeping semantics—best-effort minification.

When to use this tool

  • Embedding a small SQL statement in a log line or config.
  • Stripping whitespace before storing SQL in a metadata column.
  • Reducing bundle size when SQL is shipped as part of a migration tool.

How it works

  1. Paste the formatted SQL.
  2. Click minify.
  3. Copy the compact output.
  4. Never minify a query you intend to read regularly — minify is for machines, not humans.

Privacy: This tool runs entirely in your browser. Your input is not sent to our servers.

Best-effort compaction after formatting. Always verify semantics on your target engine.

Advertisement

Frequently asked questions

Will it strip meaningful whitespace?

No. Whitespace inside string literals is preserved. Only whitespace between tokens is collapsed.

Does it remove comments?

Yes. Both `--` line comments and `/* ... */` block comments are stripped.

Is minified SQL faster?

The database parses either form in negligible time. Minification helps payload size, not execution speed.