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
- Paste your SQL into the left box.
- Choose whether to remove comments and keep hints.
- Copy the single-line query.
- 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.