SQL Formatter
Developer ToolsBeautify SQL queries with dialect support and customizable indentation.
What is SQL Formatter?
SQL Formatter beautifies raw or minified SQL queries by adding proper indentation, capitalising keywords, and aligning clauses like SELECT, FROM, WHERE, and JOIN. It supports MySQL, PostgreSQL, SQLite, and T-SQL dialects.
How to use SQL Formatter
Choose your dialect
Select MySQL, PostgreSQL, SQLite, or T-SQL using the dialect buttons to apply the correct keyword set.
Paste your SQL
Paste a raw or one-line SQL query — however long or complex — into the input area.
Set indentation
Choose 2 or 4 spaces for indentation. Toggle "Uppercase keywords" to match your team's style guide.
Review the output
The formatted SQL appears on the right with coloured keywords, strings, and comments.
Copy or save
Click Copy to use the formatted query in your database client, or Download to save as a .sql file.
Who uses SQL Formatter?
Code reviews
Database administrators
Format queries submitted in pull requests to make them readable before reviewing logic, indexes, and joins.
Documentation
Technical writers
Beautify SQL examples in README files, wikis, and API docs so readers can follow the query structure at a glance.
Query debugging
Backend developers
Format a long, auto-generated ORM query into indented SQL to find performance bottlenecks and missing indexes.
Related Tools
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting.
Code Beautifier
Beautify minified code in JS, TypeScript, HTML, CSS, JSON, and XML.
JSON to CSV Converter
Convert JSON arrays to CSV and CSV back to JSON bidirectionally.
Fake Data Generator
Generate realistic test data: names, emails, addresses, and more.
FAQ
Which SQL dialects are supported?+
Can it handle complex queries with subqueries and CTEs?+
Does it format stored procedures?+
More Tools
View all