Compact query output
Collapse indentation, line breaks and redundant spacing so SQL can fit into compact storage, logs or embedded code.
Source
0 chars
Output
0 chars
Lines
1 to 1
Reduction
0%
Diagnostics
Code Formatter Guide
Use this SQL Minifier when readable SQL needs a compact copy for an embedded string, config value, migration snippet, log entry or payload. It removes selected line comments, block comments and extra whitespace while preserving quoted strings, quoted identifiers, semicolon separators and optimizer-style hints when configured. The page runs in your browser after it loads, shows line and size reduction stats, reports diagnostics, and gives you copy or download actions without executing the query or connecting to a database.
Collapse indentation, line breaks and redundant spacing so SQL can fit into compact storage, logs or embedded code.
Preserve quoted strings, quoted identifiers, statement separators and optional optimizer hints instead of blindly stripping text.
Compare source/output counts, line counts and reduction percentage, then copy or download the minified .sql file.
This browser SQL minifier tokenizes query text so quoted strings, double-quoted identifiers, backtick identifiers, bracketed identifiers and semicolon separators can be handled carefully. It can remove line comments, remove block comments, preserve optimizer-style hints, collapse whitespace, trim trailing spaces, keep one statement per line and change keyword case.
The diagnostics panel reports warnings such as unclosed strings, unclosed block comments, multiple statements, preserved hints, transaction statements and input that does not look like a common SQL statement. The counters show source size, output size, line count and reduction percentage so you can tell whether minification actually helped.
Minifying SQL is not the same as optimizing SQL. This tool does not inspect execution plans, create indexes, rewrite joins, bind placeholders, validate schemas or connect to a database. It only produces a smaller text representation that can be easier to embed, transmit, compare or store.
Embed queries in app config: Turn readable SQL into a compact string for JSON, YAML, environment variables or application settings.
Clean migration snippets: Create a smaller copy of a migration or seed statement while preserving strings, identifiers and semicolons.
Reduce log noise: Compress queries before placing them in tickets, audit examples, one-line logs or support notes.
Compare query text: Remove formatting differences so two SQL snippets are easier to compare as compact text.
Prepare generated queries: Minify SQL emitted by query builders after you have reviewed the readable version.
Package payloads carefully: Shrink query text for examples or transport while keeping a readable source query nearby.
Readable SQL becomes compact while quoted string content, identifiers, separators and optional hints stay visible for review.
-- active customers
SELECT
u.id,
u.email,
'keep spaces' AS note
FROM users u
WHERE u.active = 1
AND u.email LIKE '%@devbruh.dev';
SELECT u.id,u.email,'keep spaces' AS note FROM users u WHERE u.active=1 AND u.email LIKE '%@devbruh.dev';
SELECT /*+ INDEX(o idx_orders_status) */
o.id,
o.total
FROM orders o
WHERE o.status = :status;
SELECT /*+ INDEX(o idx_orders_status) */ o.id,o.total FROM orders o WHERE o.status=:status;
SQL minification often sits beside formatting, code generation and other compact-output workflows. These related tools help with the surrounding work.
Code Formatters collects browser formatters for SQL, code and structured text cleanup.
SQL Formatter turns compact SQL back into a readable review copy.
SQL Tools groups database helpers for query generation, conversion and review workflows.
SQL Code Generator helps scaffold query patterns before minifying or formatting.
Text Minifier compresses plain text when the content is not SQL-specific.
JavaScript Minifier is useful when SQL strings are embedded near browser code.
This SQL Minifier is useful, but minified output is less readable by design. Keep the original formatted query in source control, docs or review notes, especially when comments explain business rules, joins, permissions, data retention or optimizer hints.
This SQL compressor does not execute statements, validate schema names, optimize queries, inspect plans, bind placeholders, normalize every dialect or prove that results are unchanged. Review strings, quoted identifiers, hints, separators and vendor-specific syntax, then test important SQL in the target database.
It compresses SQL by removing selected line and block comments, collapsing whitespace, trimming trailing spaces, preserving quoted strings and identifiers, and showing line, size and reduction stats.
Minifying is intended to change comments, whitespace and optional keyword casing, not tables, columns, values, quoted strings or statement order. Test important SQL in the target database before relying on it.
Quoted strings, double-quoted identifiers, backtick identifiers and bracketed identifiers are tokenized and preserved carefully, but dialect-specific quoting and unfinished strings should still be reviewed.
You can remove line comments and block comments. Optimizer-style hints can be preserved when Preserve Hints is enabled, and diagnostics can report comments or hints that were removed or kept.
Yes. Minified SQL is harder to review and may remove helpful comments, so keep a readable source query for maintenance, debugging and code review.
Yes. After the page loads, SQL minification runs in your browser and pasted queries are not submitted to devbruh servers for minification. Avoid pasting secrets into any online tool unless the environment is trusted.
These references are useful when you want to compare minifier approaches, confirm SQL comment behavior or move from text compression into database-specific testing.
Code Beautify SQL Minifier is a useful comparison point for online SQL compression and download workflows.
SQLFormat.org includes compact formatting options and browser-side SQL processing context.
Poor Man's T-SQL Formatter documents SQL formatting limits and parser tradeoffs for T-SQL workflows.
MySQL comment syntax helps check comment and optimizer-hint behavior in MySQL-style SQL.