About the SQL Minifier
While well-formatted multi-line SQL is often preferred in development, inserting this type of query into a string variable in your application code (Java/Python/PHP) often causes annoying syntax errors due to the extra line breaks and tabs.
This SQL Minifier eliminates this annoying integration step by quickly compressing complex queries into a single line. It runs in your browser, so your table names and query logic are not sent to us. As you can see in the two security warnings below, your database logic is kept safe and secure.
Key Features of SQL Minifier
- Smart compression of SQLTurn any multi-line SQL query into a single line string formatted for easy application code inline by instantly stripping all redundant whitespace, line breaks and tabs.
- Preservation of stringsOur intelligent SQL minifier knows the difference between unnecessary whitespace and important values. The spaces inside your string values (WHERE name = 'John Doe') is always maintained to keep your real data safe and sound.
- Stripping of commentsRemove any developer comments (using -- or / / ) from your SQL query using the "Comments" dropdown option. This minimizes your query size and keeps your comments out of production code.
- 100% local privacyYour database schema is your own personal data. This SQL minifier is fully self-hosted and your queries are never shared or indexed in any remote database by this service.
- Keyword formattingKeep your code consistent even inside SQL strings. Use the "Keyword case" dropdown option to define how you want your SQL keywords (ALL UPPERCASE) to appear during compression.
How to Use SQL Minifier
- Paste your multi-line formatted SQL query into the input area below (or click "Sample" to try it out).
- Pick your desired capitalization using the "Keyword case" dropdown.
- Make sure that the "Comments" dropdown is set to "Remove comments".
- Finally, click "Minify" to turn your query into a single line string. You can use the "Copy" or "Download" buttons to save your compressed SQL and "Clear" to start fresh.
SQL Minifier Examples
A query with a comment reduced to one line.
SELECT id,
name -- display name
FROM users
WHERE active = 1;SELECT id, name FROM users WHERE active = 1;