I Help You

SQL Minifier

Remove whitespace and comments from SQL queries to produce compact, single-line output. Free, and it runs entirely in your browser — nothing you enter is uploaded.

How to use the SQL Minifier

1. Paste your formatted or prettified SQL query into the input.

2. Click Minify SQL — single-line comments (--) and block comments (/* */) are stripped, and all whitespace is collapsed to single spaces.

3. Copy the compact one-liner for use in configs, logs, or API strings.

What is it?

SQL minification removes redundant whitespace, indentation, and comments while preserving the exact semantics of the query. The result is a compact one-liner that any SQL engine will parse identically to the original.

This is useful when embedding SQL queries in application code as string constants, sending queries via API parameters, or reducing the byte count in high-volume query logs. Note: minified SQL is harder to read — always keep the formatted version in source control.

Example

Formatted SQL
SELECT
  id,
  name,
  email  -- user fields
FROM users
WHERE active = 1
  AND created_at > '2024-01-01'
ORDER BY name ASC
LIMIT 100;
↓
Minified SQL
SELECT id, name, email FROM users WHERE active = 1 AND created_at > '2024-01-01' ORDER BY name ASC LIMIT 100;

Comments removed, whitespace collapsed to single spaces.

Benefits

Generate INSERT and CREATE TABLE statements instantly

Convert JSON, CSV, or a field list into ready-to-run SQL in seconds — no manual quoting, no counting columns, no copy-paste errors from spreadsheet data.

Build SELECT queries without memorising syntax

The visual query builder constructs WHERE conditions, ORDER BY, LIMIT, and DISTINCT clauses interactively — useful for anyone who writes SQL occasionally rather than daily.

Migrate between MongoDB and relational databases

Convert MongoDB find, insert, update, and delete operations directly to SQL equivalents — speed up data migration planning or schema exploration.

All your data stays in the browser

No SQL query, schema definition, or database content is ever uploaded to a server. Everything runs entirely client-side, making these tools safe to use with sensitive data.

Frequently asked questions

Does minification change query behaviour?

No. The SQL engine parses minified and formatted queries identically. Whitespace is not significant between SQL tokens.

Are all comments removed?

Yes — both single-line (-- comment) and block (/* comment */) comments are stripped. If you need to keep hint comments (e.g. MySQL optimizer hints like /*+ INDEX(...) */), do not use this tool.