This tool reformats a raw SQL query so major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, HAVING, ORDER BY, LIMIT, INSERT/UPDATE/DELETE, CREATE/ALTER/DROP, UNION) each start their own line, with AND/OR/ON conditions indented beneath the clause they belong to, and keywords optionally uppercased for consistency. It works on standard SQL keywords and clause structure shared across MySQL, PostgreSQL, and SQLite, and runs entirely in your browser using plain JavaScript — nothing you paste is sent to a server. For example, a one-line query like "select u.id, u.name, o.total from users u inner join orders o on u.id = o.user_id where o.total > 100 order by o.total desc;" becomes a multi-line, indented, uppercase-keyword query after clicking Format.
Format and beautify SQL queries with syntax highlighting.
Click "Format" to see the formatted output...
A SQL query written on one line is valid but hard to read: it's not obvious where one clause ends and the next begins, or which conditions belong to which JOIN. Formatting doesn't change what the query does — it restructures the same query onto multiple lines so the logic is visible at a glance. That matters most in code review, in version control diffs (a one-line query turns any edit into a full-line change), and when debugging a query that returns the wrong rows.
This formatter puts each major clause — SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY — on its own line, indents the conditions under AND/OR/ON beneath the clause they modify, and optionally uppercases keywords so they stand out from table and column names.
Before — one line, hard to scan
select u.id, u.name, o.total from users u inner join orders o on u.id = o.user_id where o.total > 100 order by o.total desc;
After — formatted, 2-space indent
SELECT u.id, u.name, o.total FROM users u INNER JOIN orders o ON u.id = o.user_id WHERE o.total > 100 ORDER BY o.total DESC;
What does this SQL formatter actually do?
It reformats a raw SQL query into a readable, consistently indented version: major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, and so on) each start on their own line, conditions after AND/OR/ON are indented beneath their clause, and keywords can be uppercased for consistency. It does not change what the query does — only how it reads.
What formatting conventions does it apply?
Every major clause (SELECT, FROM, WHERE, JOIN variants, GROUP BY, HAVING, ORDER BY, LIMIT, INSERT/UPDATE/DELETE, CREATE/ALTER/DROP, UNION) starts a new line. AND, OR, and ON conditions are indented under the clause they belong to, at the indent width you choose (2 or 4 spaces). Keywords, functions, strings, numbers, and comments are each syntax-highlighted in the output so the structure is easy to scan.
Is my SQL sent to a server?
No. Formatting and syntax highlighting both run entirely in your browser with plain JavaScript — nothing you paste in is sent anywhere. That also means it works offline once the page has loaded.
Does it work with MySQL, PostgreSQL, and SQLite syntax?
The formatter works on standard SQL keywords and clause structure shared across MySQL, PostgreSQL, and SQLite, so common queries format correctly regardless of which database you are targeting. It does not validate database-specific syntax — it reformats the query you give it.
Powered by Ubikon Technologies | All processing happens in your browser. No data is sent to any server.