Skip to content

SQL formatter

Format your SQL queries into readable code online for free: PostgreSQL, MySQL, SQLite and more. No sign-up and your code is never sent to a server.

AvailableIn your browserInput: Text

How to use: SQL formatter

  1. Paste the SQL query.
  2. Choose the dialect (MySQL, PostgreSQL, SQL Server…).
  3. Copy the formatted query.

What it accepts and what you get

Input
SQL up to 500,000 characters.
Output
SQL with consistent indentation and keywords.
Where your data is processed
Your data is processed in your browser and is not sent to our servers.

Limitations and notes

  • Formatting does not validate the query or check that it runs on your database.
  • Nothing is executed against any database.

Frequently asked questions

How do I format an SQL query?

Paste the query, choose the dialect (MySQL, PostgreSQL, SQL Server…) and copy the result with indentation and consistent keywords.

Does it check that my query works?

No: formatting does not validate the query or check that it works on your database, and nothing is run against any database.

When to use it

  • When you inherit a SQL query written on one line and it is unreadable.
  • Before pasting a query into a code review.

Examples

Query with several JOINs
Paste the query, choose PostgreSQL or MySQL and get each clause on its own line with consistent indentation.
Switch dialect
If you use SQL Server, change the dialect so its particulars are formatted properly.

Common mistakes

  • Believing it validates the query: it only formats it and does not check that it runs on your database.
  • Thinking anything is executed: nothing is run against any database.