Skip to content

SQL Minifier & Formatter

Minify or pretty-print SQL, dropping comments safely.

Runs locallyNo signupMobile readyCopyableFree

🗜SQL Minifier & Formatter

All processing happens locally

What this tool does

SQL Minifier & Formatter is a browser-side SQL minifier and pretty-printer, implements the standard table both ways and locates invalid bytes instead of silently dropping them.

The minifier scans with a small state machine and enters string mode on single, double or backtick quotes, so -- or /* inside a literal is never removed. It is semantically safe, though dialects that rely on newlines — such as PostgreSQL $$ blocks — are worth a manual check.

How to use it

  1. Paste or type your content into the input field at the top, or press the sample button to load demo data.
  2. Adjust the options below the input, such as output format, separators, letter case or precision.
  3. Press the main button to run the conversion. Results appear instantly in the output panel without a page reload.
  4. When the result looks right, use the copy button in the corner, or download it as a local file.

Tips and notes

Clean up stray spaces and line breaks before pasting for more accurate results.

FAQ

No. Only comments and redundant whitespace are removed; keyword order and expressions are untouched, and string literals are preserved byte for byte.
If the marker appears inside a string or identifier, such as '-- not a comment', it is correctly left alone.
Plain statements are fine. For bodies with BEGIN...END or $$ delimiters, use the keyword-break layout instead of a single line.
The bytes are invalid in the chosen encoding — usually the wrong codec.
Yes. The tool is completely free with no usage limits, and you never need an account or a sign-in.
No. All processing runs locally in your browser, so the input never reaches a server and is never logged or stored.
Yes. The layout is mobile-first, so inputs and buttons stay comfortable on phones and tablets in both orientations.
Yes. A copy button in the output panel puts the result on your clipboard, and you can also download it as a text file.

Related tools

Other categories