SQL Minifier
Compress SQL to a compact single line — comments stripped, whitespace collapsed, with one-click beautify.
SQL420 B
SQL ready · 420 B · runs locally
What this tool does
Paste a SQL query — a report someone commented to death, a migration, a query destined for a string literal — and hit Minify to strip -- and /* */ comments, collapse whitespace, and tighten operators into one compact line, with the percentage saved shown in the status bar. Beautify goes the other way, pretty-printing with uppercased keywords when you need to read it. Everything runs in your browser.
How to use it
- Paste your SQL into the editor — or hit Upload to open a
.sqlfile from your machine. - Click Minify to strip comments and whitespace in place — the status bar shows the size and the percentage saved.
- Click Beautify whenever you need it readable again — keywords uppercased, one clause per line.
- Copy the result, or Download it — the file follows the active mode:
.min.sqlafter Minify,.sqlotherwise.
Frequently asked questions
Is my SQL uploaded anywhere?
No. Minification and beautification run entirely in your browser. Nothing is sent to a server, logged, or stored — safe for queries that reference production table names or business logic.
What exactly does minifying remove?
Three things: single-line comments (
-- like this), block comments (/* like this */), and insignificant whitespace — runs of spaces and newlines collapse to one space, and the space around commas, parentheses, and operators is dropped. The keywords, identifiers, and string literals themselves are untouched.Does minifying change what the query does?
No. SQL ignores extra whitespace and comments, so the minified query executes identically. One caveat: if a string literal contains a run of spaces or something that looks like a comment marker, review the output — the minifier works on the raw text, not a full SQL parse.
What does Beautify do?
It pretty-prints the query with the sql-formatter library — uppercased keywords, one clause per line, two-space indentation — using standard SQL conventions. It is the quickest way back to a readable query after minifying, or to clean up SQL copied out of a log line.
When is minified SQL actually useful?
Whenever the query travels as a string: embedded in application code, sent in an API payload, stored in a config or env var, pasted into a log search, or packed into a data-attribute. Stripping comments also keeps internal notes from leaking into places the query gets shipped.