๐๏ธ SQL Formatter
Paste a messy SQL query to reformat it into a readable, indented layout โ keywords like SELECT, FROM, WHERE, and JOIN are uppercased and each major clause starts on its own line. Switch to Minify mode to collapse a query into a single compact line. This is a best-effort formatter based on pattern matching, not a full SQL parser, so it works best on standard SELECT/INSERT/UPDATE/DELETE statements.
How to use
- Paste the SQL query you want to format or minify into the input box.
- Click "Format" or "Minify."
- See the formatted or minified query in the output box.
- Click "Copy" to copy the result to your clipboard.
FAQ
Does it support every SQL dialect?
It handles common ANSI SQL syntax (SELECT, JOIN, WHERE, GROUP BY, etc.) reasonably well, but it is not a full parser, so highly vendor-specific syntax may not format perfectly.
Is my SQL sent to a server?
No. Formatting happens entirely in your browser โ nothing is uploaded or stored.
Can it clean up a long single-line query?
Yes โ paste a long, unbroken query copied from a tool or log, and formatting breaks it into a readable, clause-by-clause layout.
Does it handle INSERT and UPDATE statements?
Yes โ it's designed to work best on standard SELECT, INSERT, UPDATE, and DELETE statements.
Will it correctly format complex SQL with subqueries?
Since it relies on pattern matching rather than a full parser, deeply nested subqueries or unusual syntax may not format exactly as expected โ check the result before relying on it.