TextArray
100% local

SQL minifier

Compress an SQL script by stripping comments and extra whitespace.

Input
Output

SQL minifier

Paste an SQL script and this tool strips the comments and collapses every run of whitespace, returning the most compact version that still runs. Typical jobs: embedding a query as a one-line string in application code, comparing a hand-written statement with what an ORM or a slow-query log actually produced, shrinking a long migration script before storing it, or squeezing a query into a URL parameter or a JSON field.

A small tokenizer walks the script character by character instead of applying blind find-and-replace, so string literals and quoted identifiers are never modified. Single-quoted strings with doubled '' escapes, double-quoted identifiers and MySQL backtick names pass through byte for byte, even when they contain -- or /* sequences that only look like comments. Comment removal covers -- line comments and /* */ blocks and can be switched off. Tight spacing additionally deletes spaces after an opening parenthesis, before a closing one and around commas. The layout option puts the whole script on one line or starts a new line after each top-level semicolon.

Two honest limits. This is the opposite of a formatter: it does not change keyword casing, re-indent or beautify anything — run the result through a formatter when you need readable SQL back. And # comments are deliberately left untouched, because removing them would destroy #temp table names in T-SQL scripts.

Minification runs entirely in your browser. Queries tend to expose table names, schema details and business logic, and none of that leaves your device — nothing is uploaded, logged or stored anywhere. The tally under the output shows bytes in and out, the percentage saved and the statement count.

FAQ

Can minifying break my query?
String literals and quoted identifiers are copied byte for byte, comments are removed whole and whitespace collapses only between tokens, so the minified script stays equivalent to the original. One caveat: some databases read directives from comments, such as Oracle optimizer hints — turn off comment removal when yours does.
Why are # comments not removed?
Because # starts a comment only in MySQL. In T-SQL, # and ## prefix temporary table names, and stripping them would corrupt those scripts, so the tool deliberately leaves # alone. Rewrite MySQL # comments as -- comments if you need them removed.
Which SQL dialects does it support?
The tokenizer understands the quoting shared by the major dialects: single-quoted strings with '' escapes, double-quoted identifiers and MySQL backticks. It never parses grammar, so PostgreSQL, MySQL, SQLite, SQL Server and Oracle scripts all work the same way.
Can it also format or beautify SQL?
No. Minifying is the opposite direction: it removes structure instead of adding it. Keyword casing stays as written and nothing is re-indented — use an SQL formatter when you need a readable layout back.
Is my SQL uploaded anywhere?
No. Everything runs locally in your browser. Queries often reveal schema and business logic, which is exactly why the tool never sends your input to any server.