SQL Minifier
Remove comments and extra whitespace from a SQL query, leaving string literals untouched.
Processed on your device. Files are not uploaded
How to minify SQL
Paste your SQL
Paste or type it into the box, or press Try an example.
Read the saving
The size before and after is shown.
Copy or download
Use the compact query in your code.
Worked example
This is what SQL Minifier gives for its own sample values. Open the tool above and change anything to try your own.
SQL
-- active users
SELECT id,
name -- display name
FROM users
WHERE status = 'active'
AND note <> 'it''s fine'
ORDER BY name;Minified
SELECT id,name FROM users WHERE status='active' AND note<>'it''s fine' ORDER BY name;
About SQL Minifier
Put a SQL query on one line by removing comments and extra whitespace. String literals are left exactly as they are, so values with spaces or dashes in them are safe.
FAQs
Are my string values safe?
Yes. Anything in quotes is kept exactly.
Does it remove hints in comments?
Yes. Both -- and /* */ comments are removed, including optimizer hints written as comments.
Can I make a query readable?
Use SQL Formatter.