Clause-per-Line Layout
SELECT, FROM, WHERE, GROUP BY, ORDER BY and more start on their own lines.
Turn messy SQL into clean, readable queries. Put each clause on its own line, indent JOINs and subqueries, and choose how keywords are cased — then copy it or minify it again.
Works with common SQL: SELECT, INSERT, UPDATE, DELETE, CTEs, JOINs, UNION and subqueries. Your queries stay in your browser.
A SQL formatter rearranges a query with consistent line breaks, indentation and keyword casing, without changing what it does. Long one-line queries from logs, ORMs or generated code become easy to read and review.
Readable SQL is easier to debug, easier to review in a pull request and easier for the next person to understand.
SELECT, FROM, WHERE, GROUP BY, ORDER BY and more start on their own lines.
JOIN conditions and nested subqueries are indented so the structure is obvious.
Uppercase, lowercase or keep keywords exactly as written.
Collapse a query to a compact single line for logs or code strings.
Strings, quoted identifiers and comments are preserved, and the tool checks that formatting did not change the query.
Queries are formatted locally and never uploaded.
Paste one or more SQL statements.
Pick keyword case and 2, 4 or tab indentation.
Your query appears neatly structured.
Copy the result or save it as a .sql file.
Quick answers about using the MoSanKit SQL Formatter.
It formats common, standard-style SQL used by MySQL, PostgreSQL, SQL Server, SQLite and others. Very dialect-specific syntax may be laid out simply rather than perfectly.
No. The tool only changes whitespace and keyword case. It also checks the result against your original and warns you if anything looks unusual.
Yes. Line and block comments are preserved when formatting.
Yes. Separate statements with semicolons and each is formatted in turn.
No. Formatting happens entirely in your browser.
It removes comments and extra whitespace to produce a compact single-line version of the query.
Explore more free developer tools from MoSanKit.