About SQL Minifier
Some places want a query on one line: a connection string, a YAML or JSON config value, a log search, a code string. Paste a formatted query and get the compact version, with comments removed and every run of spaces and line breaks reduced to one space.
The scanner knows each dialect’s quoting rules, so text inside strings, quoted names, PostgreSQL dollar-quoted bodies and BigQuery triple-quoted strings comes through unchanged, and a -- inside a string is never mistaken for a comment. Optimizer hints such as /*+ INDEX */ are kept unless you turn that off.
How it works
- The query is read with the open-source sql-formatter library, using the grammar of the dialect you choose, and printed back with each clause on its own line.
- Keywords, data types and function names take the case you pick. Names, strings, numbers and comments are kept exactly as written.
- Minify mode uses a separate scanner that knows each dialect’s quoting and comment rules, so text inside strings and quoted names is never touched.
- Everything runs in a background worker in this tab, so a long script does not freeze the page and nothing is sent to a server.
Questions
Is the one-line query safe to run?
It should behave exactly like the original. Only whitespace and comments are removed, and spaces are dropped only next to commas, semicolons and inside parentheses, where they never matter. Pick the right dialect so its strings and comments are recognised.
Why do some lines stay separate?
Client commands such as GO in SQL Server, DELIMITER in MySQL and backslash commands in psql only work on a line of their own, so they keep it. Everything between them is joined.
What if a string or comment is never closed?
The tool stops and names the line where it starts, rather than guessing where it ends and possibly cutting your query short.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.