Input SQL
Minified Output
Original: 0 BMinified: 0 BSaved: 0.0%
SQL Full Form
SQL stands for Structured Query Language — the standard language for relational databases (PostgreSQL, MySQL, SQLite, SQL Server, Oracle, and many more). Well-formatted SQL files are full of comments, indentation, and newlines for readability. Minifying strips those away for situations where you need a compact single-line form.
What this tool does
- Strip
--line comments — Everything from--to end-of-line is removed. - Strip
/* ... */block comments — Multi-line comments are removed. - Collapse whitespace — Indentation, newlines, and repeated spaces become a single space.
- Preserve string literals — Single-quoted strings (with
''escapes), double-quoted identifiers, and MySQL backtick identifiers are kept byte-for-byte. - Tighten punctuation — Removes spaces around
,,;,(, and)where safe. - Byte savings — See original vs minified byte counts and percentage saved.
When you need an SQL minifier
- Logging — When your ORM logs every query and you want a one-line, greppable form.
- Embedding — When you inline SQL in code, a config file, a migration comment, or a bug report.
- Pasting to chat/docs — A minified query fits on one line and doesn't suffer from formatting surprises.
- Pre-build artefacts — Some build tools inline migration SQL into compiled binaries; smaller is better.
Privacy
Everything runs locally in your browser. Your SQL is never sent to our servers. You can minify queries that contain schema names, PII, or sensitive table structures without them leaving your machine.
Frequently Asked Questions
No — as long as the query doesn't use line comments to split tokens (like hinting
/*+ INDEX(t idx) */ in Oracle, which the minifier does strip). Whitespace between keywords is collapsed to a single space; strings and identifiers are untouched. The optimizer sees the same query.Yes. Standard SQL
'' escape (a doubled single quote to embed a quote in a string) is preserved. Strings containing --, /*, or newlines are kept intact — the minifier only strips comments outside of string/identifier literals.Dollar-quoted strings (
$tag$...$tag$) used for PL/pgSQL function bodies are not recognised specially by this simple minifier — the function body will be treated as regular SQL and its whitespace may be collapsed. For function bodies, keep them formatted, or use a server-side tool like pgFormatter.Indented, commented SQL typically shrinks by 30–60% depending on how much documentation is inline. The primary benefit is readability in log files and chat messages, not network savings — most SQL is sent over a database connection, not a web request.
No. All minification happens in your browser. Nothing is sent to our servers, logged, or cached anywhere except the current browser tab. Paste schema-revealing queries without concern.
Click Beautify for a light reformat (newlines after semicolons and around braces). For a proper SQL formatter, use a dialect-aware tool like
pgFormatter, sqlformat, or your IDE's built-in formatter.