SQL MINIFIER
Strip comments and extra whitespace from SQL for compact, copy-ready queries. Strings stay intact and nothing is uploaded.
In short
Minify SQL queries by stripping comments and collapsing whitespace, while leaving strings and quoted identifiers untouched. Runs entirely in your browser — your queries are never uploaded.
Text inside quotes ('strings', "identifiers", `backticks`) is never altered. Comments are removed and whitespace collapsed; the query itself is not parsed or validated.
How to minify SQL
- 1
Paste your SQL query or script into the input box.
- 2
The minified version appears instantly, with comments removed and whitespace collapsed. Toggle whether MySQL /*! ... */ conditional comments are kept.
- 3
Check the byte savings, then click Copy to use the compact SQL in your code or config.
Questions
- Will minifying change what my query does?
- No. Only comments and insignificant whitespace are removed. Text inside single-quoted strings, double-quoted identifiers, and backtick identifiers is preserved exactly, including repeated spaces and newlines.
- Which SQL dialects does it support?
- It works at the character level, so it suits MySQL, PostgreSQL, SQL Server, SQLite, and Oracle. It understands -- line comments, /* block */ comments, and doubled-quote escapes. MySQL # comments are not treated as comments because # is an operator in PostgreSQL.
- What are /*! ... */ comments and why keep them?
- In MySQL and MariaDB, /*! ... */ is a conditional comment that the server actually executes, often used in dumps for version-specific syntax or optimizer hints. They are kept by default; untick the option to strip them as ordinary comments.
- Is my SQL sent anywhere?
- No. Minification happens in your browser with plain JavaScript, so queries containing table names or data never leave your device.
Related tools
- SQL ValidatorCatch unbalanced parentheses/quotes, out-of-order clauses, trailing commas, and missing JOIN conditions before you run a query.
- XML Formatter & MinifierPretty-print XML with correct indentation or strip whitespace to minify it. Catches syntax errors inline — nothing uploaded.
- JSON FormatterPaste messy JSON, get it formatted and validated.
- JSON Schema ValidatorValidate JSON data against a JSON Schema and see every failing property with its exact path and reason.
- ISO 8601 Date ConverterBuild or parse an ISO 8601 date/time, with week date, ordinal date, and Unix timestamp forms included.
- JSON VisualizerExplore JSON as a tree, table, or mindmap.
- YAML ValidatorValidate YAML syntax instantly and preview the parsed structure as formatted JSON. Clear error messages on failure — nothing uploaded.
- XML to JSON ConverterConvert XML to JSON or JSON back to XML instantly. Attributes become @-prefixed keys, arrays are handled automatically — nothing uploaded.
Updated