Home › Formatters › SQL Formatter
SQL Formatter
Format a SQL statement so SELECT, FROM, WHERE, joins and grouping each start on their own line. String literals are never touched.
How to use the SQL Formatter
- Paste your SQL query into the input box.
- Leave "Uppercase keywords" on for the conventional style, or turn it off to keep your casing.
- Press Format.
- Copy the formatted query back into your editor or console.
About this tool
A query that fits on one line is fine until it grows a join, two conditions and a subquery. This formatter covers the common SQL core — SELECT, FROM, WHERE, JOIN … ON, GROUP BY, ORDER BY, HAVING, LIMIT, INSERT, UPDATE and DELETE — and lays clauses out one per line. It understands quoted strings and comments, so text inside quotes is never reformatted by accident. Exotic vendor-specific syntax may be laid out simply rather than perfectly; check long procedural scripts before relying on the result.