SQL Minifier
Minify SQL queries by removing whitespace and comments.
Input SQL
Enter the unminified SQL query
Minified SQL
The compressed query
About SQL Minifier
The SQL Minifier aggressively compresses your SQL queries by removing unnecessary whitespace, newlines, and comments. This is extremely useful when embedding SQL queries directly into application code (like Java, Python, or Go) as a single string literal.
How to Use
Real-World Examples
Embedding in Application Code
Condense a nicely formatted query into a one-liner to easily paste it into a string variable in your backend code.
SELECT id, name FROM users -- Get active users only WHERE active = 1;
SELECT id,name FROM users WHERE active = 1;
Best Practices
- Ensure you have a backup of the original formatted query, as minification inherently destroys readability.
- If your application uses ORMs, minifying raw SQL isn't necessary, but it's great for raw query builders.
Pro Tips
The minifier intelligently preserves spaces inside string literals (e.g., `WHERE name = 'John Doe'`).
Frequently Asked Questions
Does it remove block comments?
Yes, both inline `--` comments and block `/* * /` comments are safely removed.
Is my data secure?
Absolutely. All processing is done locally in your browser.
Security & Privacy
Minification happens entirely inside your browser's memory using JavaScript regular expressions. Your database schema is never transmitted.