SQL Formatter
Format SQL queries (MySQL, PostgreSQL, SQL Server, and more) with consistent indentation and keyword casing.
About this tool
The SQL Formatter takes a cramped, one-line or inconsistently indented query and reformats it with clean line breaks, aligned clauses and consistent keyword casing. It supports MySQL, PostgreSQL, SQL Server and other dialects, so it fits whatever database your backend talks to.
Readable SQL is easier to review, easier to debug and easier to commit into version control without noisy diffs. Formatting happens entirely in your browser, so queries against production schemas — including table and column names — never leave your machine.
How to use
- Paste your raw SQL query into the input area.
- Pick the dialect that matches your database if the option is offered.
- Choose your preferred keyword casing, such as uppercase for SELECT and FROM.
- Read the formatted query with indented clauses and aligned joins.
- Copy the result back into your editor, migration file or pull request.
Features
- Supports MySQL, PostgreSQL, SQL Server and other common dialects.
- Consistent indentation for SELECT, FROM, JOIN, WHERE and GROUP BY.
- Keyword casing normalisation so all keywords look uniform.
- Keeps string literals and identifiers intact while reformatting.
- Turns hard-to-read one-liners into a reviewable, structured layout.
- Runs locally — production queries and schema names are never uploaded.
Frequently asked questions
Does formatting my SQL send the query anywhere?
No. The formatter runs entirely in your browser, so your queries, table names and column names never leave your device.
Which SQL dialects are supported?
It handles the mainstream dialects including MySQL, PostgreSQL and SQL Server, so keywords and syntax common to backend work are formatted correctly.
Will formatting change how my query runs?
No. Formatting only adds whitespace, line breaks and adjusts keyword casing. The logic of the query is unchanged and it returns the same results.
Can it format a large query with many joins and subqueries?
Yes. Complex queries with multiple joins, subqueries and CTEs are indented so the structure is visible, which makes reviewing and debugging much faster.
Should I commit formatted SQL to version control?
Consistently formatted SQL produces smaller, clearer diffs in pull requests and migration files, so it is a good habit for team codebases.