How to Format (or Minify) SQL Queries
Published September 13, 2026 · 2 min read
A long SQL query written as one dense line is hard to review or debug. This tool puts each clause on its own line, indents conditions, and breaks up long column lists — or, in the other direction, compresses a formatted query down to a single compact line.
Try SQL FormatterSteps
- 1
Open the SQL Formatter tool
Go to the SQL formatter.
- 2
Paste your SQL query
Paste the query you want to format or minify.
- 3
Choose format or minify mode
Format for readability with each clause on its own line, or minify to collapse it to one line.
- 4
Copy the result
Use the formatted or minified query wherever you need it.
Frequently asked questions
In format mode, you can choose to uppercase keywords like SELECT and WHERE, or leave them exactly as typed.
No — quoted strings, quoted identifiers and comments are protected during formatting so their content is never altered.
Minify mode strips comments entirely, since there's no room for them in a single compact line — the same way a minified script or stylesheet would.
Because both directions run instantly in your browser, you can go from a dense query to a readable one and back again in seconds.

