Bytelify

SQL Minify

Strip comments and collapse whitespace in SQL to a single line, live as you type.

Runs in your browser, nothing sent
sql-minify
Minified
SELECT id, name, email FROM users WHERE active = 1 ORDER BY name;

Strips comments and collapses whitespace to a single line, live as you type — doesn't special-case comment-like text inside a quoted string literal. Runs entirely in your browser.

Need the opposite? SQL Formatter & Beautifier

What is SQL Minify?

Paste a formatted SQL query and get it collapsed to a single compact line instantly: comments stripped, whitespace collapsed, useful before embedding a query in a config file or one-liner script. A compact single-line query is easier to paste into an environment variable, a shell command, or a log line without formatting getting mangled. Minification runs entirely in your browser.

How to Use SQL Minify

  1. 1

    Paste the Formatted SQL: Enter a multi-line, indented SQL query.

  2. 2

    Read the Minified Result Instantly: The compact single-line query appears automatically as you type.

  3. 3

    Copy the Result: Use the copy button to copy the minified query.

How It Works

Line comments (`--`) and block comments (`/* */`) are stripped out, and every run of whitespace (indentation, line breaks, extra spaces between clauses) is collapsed down to single spaces, producing one compact line. Keywords, identifiers, and string literal contents are left untouched.

Example

Before
SELECT id, name -- get user info
FROM users
WHERE active = 1;
After
SELECT id, name FROM users WHERE active = 1;

The comment and every line break collapse away, leaving one compact line.

Common Use Cases

Fitting a query into a single-line environment variable, a shell command, or a log line without newlines breaking the format, or shrinking a formatted query before pasting it somewhere space-constrained.

FAQs

Frequently Asked Questions

Common questions about SQL Minify.

Yes, use SQL Formatter to reformat it with proper indentation.

No, only comments and whitespace are removed; the SQL keywords, identifiers, and logic stay exactly the same.

Yes, Bytelify's SQL Minify tool is free with no account or sign-up required.

No. The minification runs entirely client-side in your browser, so your query is never sent anywhere.