Compress, minify, and strip comments from your SQL queries online. Reduces query payload size while preserving query logic, strings, and dialect syntax.
Paste your query into the input editor or click Upload to load a .sql file directly from your local computer.
Choose your dialect (MySQL, PostgreSQL, SQLite, T-SQL, Oracle) and set rules to strip comments, keep optimizer hints, or adjust keyword casing.
Click Minify SQL. Review the reduction percentage and click Copy or Download as a .min.sql file.
See how verbose SQL queries with indentation, extra whitespace, and comments are compressed into compact queries ready for database configs and API payloads.
/* Production Active Customers Query */
SELECT
u.id,
u.username,
o.order_total
FROM
users u
INNER JOIN orders o ON u.id = o.user_id
WHERE
u.status = 'active'
-- Only orders over 100
AND o.order_total > 100
GROUP BY
u.id,
u.username,
o.order_total
ORDER BY
o.order_total DESC;
SELECT u.id,u.username,o.order_total FROM users u INNER JOIN orders o ON u.id=o.user_id WHERE u.status='active' AND o.order_total>100 GROUP BY u.id,u.username,o.order_total ORDER BY o.order_total DESC;
| SQL Element | Minification Action | Safety Guarantee |
|---|---|---|
String Literals ('...', $$...$$) |
Preserved verbatim | Internal whitespace, commas, semicolons, and comment markers are never altered. |
Quoted Identifiers (`id`, "id", [id]) |
Preserved verbatim | Dialect-specific identifier quotation characters and casing remain intact. |
Optimizer Hints (/*+ ... */, /*! ... */) |
Retained when enabled | Database query planner hints and conditional compilation blocks are preserved. |
| Punctuation & Operators | Redundant spaces stripped | Spaces around =, ,, and ; are removed; spaces between consecutive words are protected. |
Ordinary Comments (--, /* */, #) |
Removed when enabled | Removes non-functional documentation text to maximize byte reduction. |
| Query Logic & Statement Order | Preserved 100% | No query clauses are reordered, no conditions are rewritten, and no joins are altered. |
SELECT id or users u) are carefully preserved.
-- or #) and block (/* ... */) comments are stripped. However, you can uncheck the "Strip Comments" option to keep them, or keep "Keep Hints" enabled to retain optimizer directives like /*+ INDEX(...) */ or /*!40101 ... */.
.sql or .txt file up to 5 MB using the Upload button or drag-and-drop. After minification, click Download to save the compressed output as a .min.sql file.