How to minify SQL
- Paste your SQL.
- Check the size saved.
- Copy the minified query or download it.
About this tool
Make a query as short as it can safely be. Comments and extra whitespace are removed, while anything inside quotes is left exactly as written, including text that looks like a comment, such as '--' inside a string. MySQL executable comments and optimizer hints are kept because they change what runs.
Common questions
Is it safe for strings that contain --?
Yes. The tool reads quotes first, so a double dash inside a string is part of the string and is left alone.
Which comments are kept?
MySQL executable comments that start with /*! and optimizer hints that start with /*+, because they affect the query.
Does it work for every database?
It handles single, double and backtick quotes, square-bracket names and $$ blocks, which covers the common databases.
Is it free to use?
Yes. There's no sign-up, and you can use it as often as you like.
Is my text uploaded anywhere?
No. This tool runs inside your browser, so what you enter stays on your device.
Do I need to install anything?
No. It works in your browser on a computer or a phone.