SQL Formatter
Paste a SQL query to reformat common clauses onto their own lines for readability, or compress it down to a single minified line. This is a text-only reformatter — it never executes or connects to any database.
The text is processed entirely on your device and is never sent to any server.
This is a text reformatting tool only — it never executes any SQL query or connects to any database.
Result
—
What this tool does
Reformats a SQL query by putting its main clauses on their own indented lines, or minifies it to a single line. It is purely a text reformatter.
When to use it
- A long query written on one line that is hard to read or review.
- Preparing a query for a code review or documentation.
- Hunting a mistake in a complex query and needing to see its structure.
- Normalising the formatting of queries written by different people.
How to use it
- Paste the query into the "SQL query" field.
- Click "Format" to read it, or "Minify" for one line.
- Copy the result.
A practical example
Input
select * from users where id = 1 on a single line.
Output
The same query with each main clause on its own indented line, showing its structure.
Limitations
- This is a text reformatting tool only — it never executes any SQL query and never connects to any database, and the input is treated as plain text throughout.
- The formatting is keyword-based rather than a full SQL parser for every dialect, so queries using dialect-specific syntax may not format perfectly.
- It does not validate the query or report errors in it.
Privacy and processing
The text is processed entirely on your device and is never sent to any server — which matters, because queries routinely contain real table names and database structure.
Technical notes
- Not connecting to a database is a design property rather than a gap: the tool has no mechanism to execute anything, so pasting a destructive query into it carries no risk.