Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

SQL Minifier

Reduce SQL size fast by stripping whitespace and comments. Drop in your code, get a minified result, and copy it for production builds.

SQL Minifier



Last updated: April 20, 2026

Created by: Eon Tools Dev Team

Reviewed by: Sugam Baskota



What this does

So you want a SQL query stripped down to its essentials, no comments, no extra spacing, just the statement. This minifies it. Paste your SQL, hit Minify, and you get a single compact line back.

How to use it

  1. Paste your SQL query into the box.
  2. Hit Minify.
  3. Copy the minified query with the Copy button.

How it works

Unlike the other minifiers here, this one does not use a library. It works through a series of text replacements: it removes line comments that start with -- and block comments wrapped in /* */, tightens the spacing around symbols like =, <, >, commas, brackets, and semicolons, and collapses the remaining runs of whitespace down to single spaces. What you are left with is your query with the slack squeezed out. It runs locally in your browser, so your query is never sent away.

One thing to watch

Because it works by matching patterns rather than truly understanding SQL, there is one thing worth knowing. It cannot tell the difference between a real comment and the same characters sitting inside a string value, nor between spacing that is decorative and spacing that is part of a piece of text. So if your query contains string literals with -- or /* */ inside them, or text where the exact spacing matters, give the output a quick check before using it. For everyday queries without those quirks, it does the job cleanly.

Questions people ask

Does it use a library?

No. It minifies by applying a set of text replacements that strip comments and squeeze out spacing, rather than parsing the SQL.

What does it remove?

Line comments starting with --, block comments in /* */, and the extra whitespace around symbols and between words, leaving a compact single line.

Could it affect my string values?

It can, in rare cases. Since it matches patterns rather than parsing SQL, a string containing comment markers or meaningful spacing might be altered, so check the output if your query has those.

Is my query uploaded?

No. It runs entirely in your browser, so the query you paste stays on your machine.

References

  1. PostgreSQL. SQL Syntax: Lexical Structure. https://www.postgresql.org/docs/current/sql-syntax-lexical.html


Sugam Baskota

Sugam Baskota is a senior software engineer and Computer Science graduate from UT Arlington, with interests in user scripts, browser extensions, developer tooling, and productivity systems. He spends time building practical utilities and extensions in the kinds of workflows Eon is designed to simplify. At Eon Tools, he reviews useful, password, and developer tools.