Clause-Aware Layout
Each clause, SELECT, FROM, WHERE, JOIN, GROUP BY, starts on its own line, with conditions and subqueries indented.
Clean up messy SQL in your browser. Format queries with clause-aware indentation and uppercase keywords, or minify them to one line. Free, no signup, nothing uploaded.
Drop in your query, or upload a .sql file. The formatted result appears right away.
Choose Format to break the query across clauses with indentation, or Minify to collapse it to one line. Set the indent and keyword case.
Copy the result or download it as a .sql file, ready to paste into your editor or migration.
SQL has a habit of arriving as one dense line, copied from an ORM log, a stored procedure, or a teammate who never hits enter. Reading a query like that, or spotting why a join is wrong, means scanning a wall of text for the keywords that mark each clause.
This formatter rebuilds the query so the structure is obvious. Each clause starts on its own line, conditions under WHERE are indented, and subqueries are nested so you can see exactly where one query sits inside another. Quoted strings and comments are left exactly as they are.
You control the style. Uppercase the keywords for the classic look or keep them lowercase, choose your indent size, and switch to minify when you need a single-line version for a script. It all runs in the browser, so queries with real table and column names stay on your machine.
Each clause, SELECT, FROM, WHERE, JOIN, GROUP BY, starts on its own line, with conditions and subqueries indented.
Turn SQL keywords into uppercase for a clean, consistent style, or keep them as they are.
Beautify a tangled query, or minify it to a single compact line for logs and scripts.
Quoted values and comments are preserved exactly, so your data and notes are never altered.
Keywords, strings, numbers, and comments are colored so the query is easy to read.
Your SQL is formatted on your device. Nothing is uploaded, logged, or stored.
More Developer tools you might find useful.
Common questions about formatting SQL.