Code Formatters

SQL Formatter

Format queries for Standard SQL, MySQL, PostgreSQL, or SQLite.

Press Ctrl / ⌘ + Enter to run
Read-only result

Format queries for Standard SQL, MySQL, PostgreSQL, or SQLite.

What this tool does

SQL Formatter organizes indentation and line breaks in queries. Choose the dialect that matches your database so keywords, identifiers, and operators are handled correctly.

  • Provides Standard SQL, MySQL, PostgreSQL and SQLite.
  • Keywords should be in uppercase, and the indentation can be 2 or 4 spaces.
  • SQL is always text only, no database connection is established.

How to use it

  1. Paste the SQL query.
  2. Select the corresponding SQL dialect and indent width.
  3. Click "Format SQL".
  4. View parsing errors or copy formatting results.

Common uses

  • Organize JOINs, subqueries, and complex WHERE conditions.
  • Unify migration scripts and code review formats.
  • Discover inapplicable syntax through dialect parsing.

SQL Formatter Features

Format query text in Standard SQL, MySQL, PostgreSQL, or SQLite dialects. Review the result, then copy it for use.

FAQ

Will formatting execute the query?

No. SQL Formatter simply parses the query text and adjusts keywords, line breaks, and indentation.

Which dialect should I choose?

Select the database that will actually run the query; start with Standard SQL if you are unsure and want to use a common syntax.

Are stored procedures supported?

sql-formatter is mainly oriented to queries and common statements. Complex stored procedures and custom delimiters may be beyond the scope of support.

Back to Developer Tools