Paste a SQL query and the formatter (sql-formatter library) puts each clause on its own line, indents joins and conditions, and applies your preferred keyword case for MySQL, PostgreSQL, SQL Server and other dialects.
How to format SQL
- Choose your database dialect.
- Paste the query.
- Copy the formatted SQL.
Why format SQL?
Formatted queries are easier to review, debug and compare in version control. Logs and ORMs usually output queries on a single line.
Frequently asked questions
Does it run my query?
No. It only reformats text. Nothing connects to a database.
Updated October 2026 · Built and tested by Sharjeel Tahir · How our tools are tested