Skip to content
M2TOOLKIT

SQL Formatter

Format long SQL queries so they're easy to read and review.

  • Free
  • No sign-up
  • Runs in your browser
Keywords

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to use the SQL Formatter

  1. Paste your SQL query.
  2. Choose the dialect and keyword case.
  3. Copy the formatted query.

What does this tool do?

Each clause (SELECT, FROM, JOIN, WHERE, GROUP BY…) starts on its own line, with columns and conditions indented underneath. Choosing the right dialect helps with database-specific syntax.

Why use it?

  • Review queries in pull requests.
  • Debug long generated queries.
  • Consistent style across a team.

Example

select id,name from users where active=1 order by name becomes
SELECT
  id,
  name
FROM
  users
WHERE
  active = 1
ORDER BY
  name

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the sql formatter.