About SQL Code Formatter
Paste messy or minified SQL and instantly get clean, properly indented output. Each clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) starts on its own line. SELECT columns and WHERE conditions are each on their own indented line. Choose UPPERCASE, lowercase, or preserve for keyword casing. Works with MySQL, PostgreSQL, SQLite, SQL Server, and standard SQL.
Frequently Asked Questions
What is a SQL formatter?
A SQL formatter rewrites SQL queries with consistent capitalisation, indentation, and clause alignment — SELECT and FROM on separate lines, JOIN conditions indented, and WHERE clauses aligned. It makes long queries readable and easier to debug.
Can the SQL formatter change keyword casing to uppercase?
Yes. The formatter normalises SQL keywords (SELECT, FROM, WHERE, JOIN, ON, GROUP BY, ORDER BY, etc.) to uppercase, which is the near-universal SQL convention. Column names, table names, and string literals are left in their original case.
What SQL dialects does the formatter support?
The formatter supports standard SQL (ANSI) and the major dialects: PostgreSQL, MySQL/MariaDB, Microsoft SQL Server (T-SQL), Oracle (PL/SQL), and SQLite. Dialect-specific syntax (TOP N, LIMIT, ROWNUM, CTE syntax differences) is handled correctly for the selected dialect. Choose your dialect from the dropdown for accurate formatting.
Does formatting SQL change query execution behaviour?
No. SQL formatting only changes whitespace and casing — it has no effect on query semantics or execution plan. The database server receives identical instructions whether the SQL is minified, formatted, or written in any casing style. Only the query text changes, not its meaning.
How do I format a SQL file with multiple queries separated by semicolons?
Paste the entire file including all semicolons. The formatter handles multi-statement SQL files by treating each semicolon-terminated statement as an independent query. Each statement is formatted separately with consistent indentation and the full file is returned in one block.
Advertisement300 × 250
Advertisement300 × 250