SQL formatter

Format SQL queries into clean, readable code.

  • Development
  • 100% free
  • No sign-up
  • Runs in your browser
SQL formatter

What is the sql formatter?

The SQL formatter rewrites a query with one clause per line (SELECT, FROM, WHERE, GROUP BY, ORDER BY…), joins and conditions indented, subqueries nested and keywords in the case you choose. It works with MySQL, PostgreSQL, SQL Server, SQLite and Oracle syntax.

Strings, quoted identifiers and comments are left untouched, and several statements separated by semicolons are formatted one after the other.

How to use the sql formatter

  1. 1Paste the SQL query.
  2. 2Choose the keyword case and the indentation.
  3. 3Press Format and copy the result.

Features

Readable layout

Clauses, joins and AND / OR conditions on their own lines.

Subqueries

Nested queries are indented.

Keyword case

UPPERCASE, lowercase or as written.

Safe

Strings and comments are never changed.

Frequently asked questions

Which SQL dialects are supported?

The formatter works on the common syntax of MySQL, MariaDB, PostgreSQL, SQL Server, SQLite and Oracle.

Does it check my query for errors?

No, it only changes the layout. Run the query to find syntax errors.

Should SQL keywords be uppercase?

It's a convention, not a rule; uppercase keywords make queries easier to scan.

Is my query sent to a server?

No, it's formatted in your browser.