SQL Minifier
Compress SQL queries by stripping comments, tabs, line breaks, and consecutive whitespaces.
Database
Raw SQL Query
Minified SQL Query
What is an SQL Minifier?
An SQL Minifier is a developer utility that optimizes SQL queries by reducing their file size and layout footprint. It achieves this by stripping out SQL comments (both single-line -- or # and block /* ... */), removing unnecessary line breaks and indentation, and condensing multiple spaces into single characters. It does all of this while strictly preserving string literals and quotes to ensure the query remains syntactically valid and executable.
How to use the SQL Minifier
- Paste your raw SQL query into the Input editor.
- The tool will minfy your query in real-time.
- Review the output metrics:
- Original Size: The byte count of your formatted, commented query.
- Minified Size: The optimized byte count.
- Compression Ratio: The percentage of bytes saved during compression.
- Use Copy or Download to retrieve the compressed SQL query.
Example
- Input:
-- Get all active users
SELECT id, name, email
FROM users
WHERE status = 'active' /* active status only */;
- Output:
SELECT id,name,email FROM users WHERE status='active';