SQL Formatter
SQL
Result
ExampleHow to use
1.
Paste your query into the SQL panel
2.
Pick the Dialect that matches your database
3.
Set Keyword case (UPPER or lower) and Indent (2, 4 or Tab) - the Result panel updates as you change them
4.
Copy or download the formatted SQL
Common uses
▸
Cleaning up minified or auto-generated SQL before reviewing it
▸
Formatting queries from ORM debug output for readability
▸
Standardising keyword casing across a team codebase
▸
Quickly checking query structure without running it
Similar tools
Frequently asked questions
Which SQL dialects are supported?
The tool supports Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, T-SQL (Microsoft SQL Server), PL/SQL (Oracle), BigQuery, Snowflake, and Amazon Redshift via the sql-formatter library.
Does it validate SQL syntax?
Only loosely. If the selected dialect cannot read the input - an unclosed quote, for example - an error with the line and column appears instead of a result. Beyond that it only lays the query out: it does not run it or check it against a schema, and even an incomplete query such as SELECT FROM WHERE formats without complaint.
Is my SQL sent to a server?
All formatting runs locally in your browser using the sql-formatter library. No queries are transmitted anywhere.
Can I format stored procedures and subqueries?
Subqueries, CTEs (WITH clauses), JOINs, and CASE expressions format well. Procedural code is only partly supported: statements inside a procedure body are formatted one by one, and client-side commands such as MySQL's DELIMITER // are not understood, so remove them before formatting.
What does keyword case do?
Keyword case controls whether SQL keywords like SELECT, FROM, and WHERE appear in UPPERCASE or lowercase in the formatted output. Function names (COUNT, CAST) and data types (VARCHAR, INT) follow the same setting; table and column names are left as written.