Shard Tools

SQL Minifier

Minify SQL instantly in your browser.

Maintained by Roshan.

Use SQL Minifier

Converts sql to minified sql in this tab, with nothing sent anywhere.

Runs entirely on your deviceThe conversion happens in this browser tab. Nothing you type is uploaded, logged or stored, which is worth knowing for anything you would not paste into a search box.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About SQL Minifier

A SQL minifier does the opposite of a formatter: it strips comments and collapses a multi-line query onto a single compact line. That is what you want when a query has to be embedded in a string, a config value, a log line or a URL parameter, where newlines and indentation are noise or break the surrounding format. This tool removes SQL comments and squeezes the whitespace in the browser, leaving a one-line query that means exactly the same thing. Because it runs on your device, a query carrying private schema detail is compacted without being uploaded anywhere. It is also handy for comparing two queries: once both are minified to a single canonical line, a diff shows only the parts that genuinely differ rather than every difference in indentation and comments. And for anyone pasting SQL into a JSON payload or a YAML value, a one-line query avoids the escaping that multi-line strings force in those formats.

Using SQL Minifier

  1. Paste your formatted, multi-line SQL. It is minified in this browser tab.
  2. Line comments (--) and block comments (/* */) are removed, and runs of whitespace are collapsed to single spaces.
  3. Copy the single-line result, ready to embed in code, a config file or a log without newlines getting in the way.

Where sql minifier helps

Embedding a query

A multi-line query is collapsed to one line so it can be stored as a single config value without escaping newlines.

Tidying a log line

A query is minified before being written to a log, keeping each entry on a single readable line.

Preserve the original query for review

A shorter query is harder to inspect and its length does not predict database performance. Keep the formatted source and compare quoted strings and statement boundaries after minification. Execution plans, indexes and row counts drive query cost; removing spaces does not optimize those operations.

Before you use the result

Questions about SQL Minifier

Does minifying change results?

No. Only comments and extra whitespace go; the query runs identically to its formatted version.

Are string literals safe?

Yes. Whitespace inside quotes is preserved, so text values inside the query are not altered.

Related tools

SQL Formatter

SQL Formatter in your browser. Instant, accurate, and nothing is uploaded.

JSON to SQL

Turn a JSON array into SQL INSERT statements in your browser, with quotes escaped correctly.

CSS Minifier

CSS Minifier in your browser. Instant, accurate, and nothing is uploaded.