SQL Minifier
Compress your SQL queries by removing comments and unnecessary whitespace to reduce overhead and improve performance.
// Minified SQL will appear here...
Performance Gain
Reducing the size of SQL strings sent to your database can lower network latency and memory usage in high-volume applications.
Comment Stripping
Effectively removes both single-line (--) and multi-line (/**/) comments while preserving your query logic.
About the SQL Minifier
Paste a formatted SQL query and get it on a single line without comments – useful for logs, environment variables, code strings and query parameters.
Everything you enter is processed in your browser; nothing is uploaded or stored.
How to use it
- Paste your SQL into Input SQL.
- Copy the single-line query from Minified SQL.
- Check the size saving shown under Performance Gain.
What the SQL minifier removes
It removes /* block comments */ and -- line comments, replaces line breaks and tabs with spaces, and collapses repeated spaces into one. Keywords, identifiers and values are left exactly as written.
The database executes the minified query the same way; whitespace and comments have no effect on the query plan.
Example
SELECT id, name -- active users FROM users WHERE active = 1; becomes SELECT id, name FROM users WHERE active = 1;
Tips
- A -- inside a string literal (for example a URL) would be treated as a comment; check queries that contain such strings.
- To make a minified query readable again, use the SQL Formatter.
Frequently asked questions
Does minifying SQL make queries faster?
Not measurably for the database – execution is the same. It saves bytes when queries are stored or sent, and makes them easier to embed in code.
Which SQL dialects does it support?
Any dialect (MySQL, PostgreSQL, SQL Server, SQLite), because it only removes comments and whitespace.
Is my query uploaded?
No, it is processed in your browser.