Skip to content
SQL Minifier

SQL Minifier

Minify SQL queries online. Strip comments, collapse whitespace, and produce compact, single-line SQL ready for storage or transmission.

Removes single-line (--) and block (/* */) comments Collapses whitespace and newlines Preserves string literals and identifiers Copy and download minified SQL Import SQL from URL or file Theme switcher Fullscreen editor mode

Input SQL

Paste your SQL here

Minified SQL

Copy or download the minified output

Key Features

  • Removes single-line (--) and block (/* */) comments
  • Collapses whitespace and newlines
  • Preserves string literals and identifiers
  • Copy and download minified SQL
  • Import SQL from URL or file
  • Theme switcher
  • Fullscreen editor mode

How to Use

  1. Paste your SQL into the input editor.
  2. Click Minify to strip comments and collapse whitespace.
  3. Copy or download the minified output.
  4. Need it readable again? Use the SQL Formatter.

Free Online SQL Minifier

Compress SQL queries into a single line with our online SQL minifier. Paste a query — formatted, commented, multi-line — and the tool removes -- comments, /* */ blocks, and excess whitespace while preserving string literals, identifiers, and operators. Perfect for embedding SQL in code, application logs, configuration files, or anywhere compact output matters.

What the minifier removes

  • Single-line comments: Everything from -- to the end of the line
  • Block comments: /* ... */, including multi-line blocks
  • Redundant whitespace: Tabs, newlines, and runs of spaces collapsed to a single space
  • Space around punctuation: Trimmed around ;, ,, (, ), =

What is preserved

  • String literals: Single, double, and backtick quoted values are kept verbatim, including embedded escape characters and SQL-standard doubled quotes
  • Identifiers: Table and column names retain their original casing
  • Statement separation: The final ; can be kept or stripped via the toggle

When to minify SQL

Use this tool when you need to store SQL inside a JSON payload, embed it in a Bash script, or pass it through a system that limits line length. Compact SQL is easier to grep and faster to transmit. Need a readable version again? Run the output through the SQL Formatter to restore indentation.

Privacy and performance

  • Everything runs in your browser — your SQL never leaves the page
  • No login, no quota, no installation
  • Works on desktop, tablet, and mobile

Combine the SQL Minifier with the SQL Formatter and our JSON Formatter when working with API payloads that carry queries inside JSON.

Latest from Our Blog

Tips, tutorials, and insights about web development