SQL minifier

An SQL minifier removes comments and unnecessary whitespace without changing what the query does.

Features

  • Strings untouchedQuoted values and identifiers are preserved exactly.
  • Hints keptOptimizer hints and MySQL conditional comments stay.
  • Runs on your deviceYour data is processed in the browser and is never uploaded.

How to use the SQL minifier

  1. Paste your SQL.
  2. Tick backslash escapes for MySQL strings that use them.
  3. Copy the minified query.

Why a tokenizer matters

Removing everything after -- with a simple search would damage a string that contains two hyphens. This tool reads quotes and comments in order.

Frequently asked questions

Does it validate SQL?

No.

Which dialects work?

Common standard SQL, plus backticks, brackets and dollar quotes. Test dialect-specific syntax such as # comments.

Does minifying speed up queries?

Not meaningfully. It mainly helps embedding and transport.

Related tools