ConvertAnyFiles

SQL Formatter

Turn long, one-line SQL into readable, properly indented queries, or minify it back into one line. Choose your database dialect for correct handling of its syntax.

Free · No sign-up · Files stay on your device

How to use SQL Formatter

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

Features

  • MySQL, PostgreSQL, SQL Server, SQLite, Oracle, BigQuery…
  • Uppercase or lowercase keywords
  • 2 or 4 spaces or tabs
  • Minify to one line
  • Clear error messages

Why format SQL?

Well-formatted SQL puts each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) on its own line and indents nested queries, which makes complex queries much easier to review, debug and keep in version control.

Frequently asked questions

Is my SQL sent anywhere?

No. Formatting runs in your browser, so queries with sensitive data stay private.

Does it check that my query is valid?

It reports syntax it cannot parse, but it does not run the query against a database.

Can it format multiple statements?

Yes. Statements separated by semicolons are formatted one after another.

Related tools