Skip to content
hateitall

SQL Minifier

Squeeze a multi-line query into one line for a config value, a log search or a code string.

Processed locallyIn: SQLOut: SQL

Loading tool…

How to use sql minifier

  1. Paste SQL or open a .sql file.

  2. Pick the dialect.

  3. Choose whether to keep comments (converted to /* */ so they cannot swallow the rest of the line).

  4. Copy the one-line SQL.

What this tool does

  • Removes only whitespace the database does not need, keeping a space where two words would otherwise merge.
  • Never changes text inside strings, quoted names or dollar-quoted bodies.
  • Turns -- comments into /* */ when you keep them, so the single line stays valid.
  • Shows the size before and after.

How the result is verified

The minified SQL is split into tokens and compared with your input token for token, ignoring removed comments.

Frequently asked questions

Why are -- comments a problem on one line?

A -- comment runs to the end of the line, so on a single line it would comment out everything after it. The minifier drops them or rewrites them as /* */.

Does it shorten table or column names?

No. Renaming would change what the query means, so only whitespace and comments are removed.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Readable SQL with clauses, joins and subqueries laid out

SQL→ SQLLight on device

Beautify or minify JSON with your choice of indentation

JSON→ JSONLight on device

Batched INSERT statements from pasted CSV or JSON

CSV · JSON→ SQLLight on device