Skip to content

SQL Minifier

Minify SQL by removing comments, line breaks and every space that is not needed, while string literals, quoted identifiers and operators stay intact. Pick a dialect such as MySQL, PostgreSQL, T-SQL or BigQuery so quoting, comment and batch rules match your database. The minifier reports unclosed strings, comments and parentheses with line and column, which suits developers embedding queries in code.

Reset

Frequently asked questions

What does the SQL minifier remove?

It removes line comments, block comments, line breaks and indentation, and keeps a single space only where two words or operators would otherwise merge. String literals and quoted identifiers stay exactly as written.

Why should I pick a dialect?

Databases quote and comment differently. MySQL treats # as a comment and backslashes as escapes, PostgreSQL has dollar-quoted strings, T-SQL uses [brackets] and GO batches, and BigQuery has triple-quoted strings. The dialect makes sure nothing inside a literal is changed.

Are any comments kept?

Yes. MySQL and MariaDB executable comments, the block comments whose text starts with a version marker, and optimizer hints such as /*+ INDEX(t) */ are kept, because they change how the statement runs. All other comments are removed.

What happens to GO, / and DELIMITER lines?

Batch separators like GO in T-SQL, the / line in Oracle scripts and MySQL DELIMITER commands stay on their own lines. Client tools only recognize them there, so joining them with other code would break the script.

Can minifying break a query?

The minifier only removes whitespace and comments outside literals and keeps spaces between operator characters, so a - -1 never turns into a comment. The query runs the same way as before.

Which errors are detected?

Unclosed string literals, quoted identifiers, block comments and dollar-quoted strings, and unbalanced parentheses are reported with their line and column. It does not check the full SQL grammar.

Which dialects are available?

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, T-SQL, PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL, Hive, Trino and Db2. Standard SQL, the default, uses single-quoted strings without backslash escapes and accepts double quotes, backticks and brackets for identifiers.

Does it change keyword case?

No. Keywords, identifiers and functions keep their original case. Only whitespace and comments are removed.

How large can the input be?

Up to 1 MB of SQL per request. Long migration scripts with many statements are minified in a single pass.

Is my SQL stored?

No. Queries are processed in memory and returned immediately. They are never saved and only request sizes are logged.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.