SQL Minifier
Minify and compress SQL queries into a single line — removes comments and redundant whitespace while preserving string literals and quoted identifiers exactly. Dialect-aware (--, #, /* */). 100% client-side.
About SQL Minifier
Minify and compress SQL queries into a single line — removes comments and redundant whitespace while preserving string literals and quoted identifiers exactly. Dialect-aware (--, #, /* */). 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does the SQL minifier protect string literals?
We tokenize the SQL before stripping whitespace, so string literals ('…', "…", `…`, [bracket]) are treated as atomic units. Their contents — including any spaces, --, #, /* */ sequences, or semicolons inside them — are preserved verbatim. Only whitespace between tokens is collapsed.
What comment syntaxes are supported?
Three styles: SQL standard '--' line comments (ANSI/PostgreSQL/SQLite/T-SQL/MySQL), MySQL '#' line comments, and '/* … */' block comments (with PostgreSQL-style nesting). Toggle comment removal on/off; when off, comments are kept in their minified form.
Can I keep newlines between multiple statements?
Yes. By default the minifier outputs a single line, but switch 'Newlines' to 'Keep newlines between statements' and each semicolon-terminated statement goes on its own line. Consecutive semicolons can optionally be normalized to one.
What output modes are available?
Plain minified SQL (default), or a JS/JSON string-escaped variant for embedding SQL inside JavaScript code — useful for query builders, test fixtures, and configuration files. The escaped mode wraps the result in double quotes and escapes ", \, and newlines.
What extra features does this tool have versus others?
(1) Five-dialect tokenizer (ANSI/MySQL/PostgreSQL/SQLite/T-SQL). (2) Toggle comment removal (-- # /* */). (3) Single-line or keep-newlines-between-statements mode. (4) Semicolon normalization. (5) JS/JSON string-escaped output for embedding. (6) String-literal safety (single, double, backtick, bracket). (7) Live byte + percentage savings meter. (8) Statement counter. (9) localStorage history (max 20). (10) Shareable-URL config. (11) Copy / download .sql. (12) One-click sample SQL. Pairs reversibly with the SQL Formatter.
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.