Zero Signup ToolsFree browser tools

Developer Tools

SQL Minifier

Minify SQL in your browser. Strip comments, collapse whitespace, uppercase keywords, and emit a one-line query. See bytes saved live.

SQL minifier

0 B

Optimization options

Your SQL is minified entirely on your device. Nothing is uploaded.

How to use

  1. Paste your SQL into the input area on the left, or click Load sample to try the minifier with a multi-statement query.
  2. Choose which comments to remove. Strip line comments (--) and Strip block comments (/* */) are independent toggles.
  3. Optionally turn on Uppercase SQL keywords to rewrite select, from, where as SELECT, FROM, WHERE while leaving identifiers and string literals untouched.
  4. Read the minified output on the right with byte savings updating live, then click Copy SQL to grab the result or Replace with minified to load it back into the editor.
  5. Toggle One statement per line if you want each statement on its own line for log-friendly output, or Drop trailing semicolon to remove a single semicolon at the end of the script.

About this tool

SQL Minifier compacts a SQL script into the smallest equivalent form your browser can produce. Paste any SELECT, INSERT, UPDATE, DELETE, MERGE, or DDL statement, or a multi-statement script separated by semicolons, and the minified result appears on the right as you type. The tool is built around a small SQL tokenizer plus a careful printer, so it handles the syntax that real queries use: single-quoted string literals (including doubled-quote escapes like 'it''s ok'), double-quoted and backtick-quoted identifiers, line comments that start with -- and run to the end of the line, and block comments wrapped in /* ... */ that span multiple lines. Strings and identifiers are passed through verbatim, never reformatted, so column names with spaces, content with embedded SQL keywords, and JSON payloads inside string columns survive the minification intact. Five independent options let you tune the output: strip line comments, strip block comments, uppercase reserved SQL keywords like select, from, where, join, group by, having, order by, limit, drop a single trailing semicolon at the very end of the script, and insert a newline after every semicolon so each statement sits on its own line for log-friendly one-line-per-statement output. The byte counter at the top of the output measures the actual UTF-8 byte size with TextEncoder, not character length, so multi-byte characters in identifiers or string literals are counted correctly. Useful for shrinking queries pasted into URL parameters, JSON payloads, CI environment variables, log messages, and any place where every byte counts; for normalizing a query before hashing or caching it; for stripping the comment noise out of a script before sharing it in a code review; and for turning a wall of indented training SQL into a single line that fits into a tooltip. Tokenizing and printing both run on your device, so the queries you paste here, including any production schemas, table names, and business logic embedded in them, never leave your browser.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools