Useful Hacks

SQL Minifier

Strip comments and collapse whitespace to compress SQL.

Processed locally in your browser. Nothing you enter is uploaded or stored.
  • Tokenizes the query rather than using a single regex, so `--` or `/*` inside a quoted string is never mistaken for a real comment.
  • Removes line and block comments along with all non-essential whitespace.
  • Runs in your browser; queries aren't uploaded.

Why this is private

  • Processed locally in your browser. Nothing you enter is uploaded or stored.
  • Open your browser's DevTools → Network tab while using this tool — you won't see a request carrying your input, because it never leaves your device.
  • Nothing you enter is uploaded to a server or shared with us — the processing happens entirely on your device.

Overview

Strips comments and collapses whitespace in a SQL query to its smallest form, without touching the contents of any string literal.

How to use it

  1. 1Paste a SQL query.
  2. 2The minified output updates automatically.
  3. 3Copy it or download as .sql.

Examples

Formatted to minified

Input

SELECT id, name -- primary key FROM users WHERE active = true

Output

SELECT id, name FROM users WHERE active = true

Tips

  • Minifying only removes comments and non-essential whitespace — it never changes a value or identifier inside a string literal, so behaviour is identical.

Frequently asked questions

What people use it for

Shrink a query before embedding it in application codeRemove indentation and comments from a query stored as a string literal or config value.
Prepare a query for a log line or single-line contextCollapse a formatted query into one line without losing meaning.
Clean a query pasted from a tool or ORMStrip generator comments before sharing or storing the query.

Related guides

Related tools

All developer tools

Ready to use SQL Minifier?

SQL Minifier

Search tools

Search for any tool by name, category or keyword