Skip to content
TabKiwiTabKiwi

SQL Minifier

Collapse a formatted SQL query onto one line, stripping comments but keeping strings and hints intact.

DeveloperRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

Useful when a query has to fit into a log line, a JSON string or a config value. Line and block comments are removed and runs of whitespace become single spaces, while string literals, quoted identifiers, PostgreSQL dollar-quoted bodies and optimizer hints such as /*+ INDEX(t) */ are left exactly as written. The query is processed locally.

How to use SQL Minifier

  1. Paste your SQL into the left box.
  2. Choose whether to remove comments and keep hints.
  3. Copy the single-line query.
  4. Use the SQL Formatter if you need it readable again.

Frequently asked questions

Can a “--” inside a string break the result?

No. Strings and quoted identifiers are recognised first, so comment markers inside them are left alone.

What happens to comments if I keep them?

Line comments are turned into /* */ comments, because a -- comment would swallow the rest of a one-line query.

More Developer tools

View all 91 →