← Back to tool

Minify · Compact · One line

SQL Minifier

Updated: June 2026

Sometimes you need the opposite of pretty: one tight line with no wasted whitespace. The minifier strips line breaks and extra spaces while keeping strings and comments intact, so the query still runs.

Minify My SQL →

Free · No upload · Instant in the browser

Why minify SQL

Most of the time you want SQL spread out and readable, but there are moments when a single line is exactly right. When you embed a query as a string literal in application code, every line break becomes an escape sequence; a one-liner keeps the string clean. When you log queries, a compact form keeps each entry on a single row so log viewers stay tidy. And some command-line tools or config formats simply expect one line of SQL per setting.

Minifying gives you that compact form without retyping anything. Paste the formatted query, switch to minify, and copy the result back as a single tight statement.

What the minifier removes — and keeps

  • All newlines and indentation collapse into single spaces.
  • Runs of whitespace shrink to exactly one space where a space is needed.
  • String literals are left byte-for-byte intact, including any spaces inside them.
  • Block comments stay inline; line comments keep a following break so they do not comment out the rest.

The point is to make the query smaller without changing what it does. A minified query parses to the same statement as its formatted twin.

Formatted to minified

SELECT
  id,
  name
FROM
  users
WHERE
  active = 1;

becomes:

SELECT id, name FROM users WHERE active = 1;

Short enough to drop into a code string or a log line, but still perfectly valid SQL you can run as-is.

Round-trip whenever you like

Minifying is not a one-way door. Because the tool can both minify and format, you can compact a query to embed it, then later paste the same one-liner back and beautify it to read or edit it. Nothing is lost in the trip except whitespace. And as with every Flowfiles tool, the work happens entirely in your browser — your queries are never uploaded, so even minifying a statement full of internal table names is completely private and works with no internet connection.

Frequently asked questions

What does minifying SQL do?

It removes line breaks and redundant spaces so the whole query fits on one line. The statement still parses and runs — it is just compact instead of spread out.

When would I minify a query?

Useful when you need a query as a single string: embedding it in code, pasting it into a one-line config value, storing it in a log, or sending it through a tool that expects one line.

Does minifying remove my comments?

Block comments are preserved inline. Line comments end at a newline, so the minifier keeps a break after them to avoid swallowing the rest of the query.