Toolstia / SQL formatter

SQL formatter

Paste a long SQL query and get it back with each clause on its own line and consistent indentation. Choose your database dialect, keyword case and indent size. Your SQL stays in your browser.

How it works

  1. Paste your SQL or press Use sample.
  2. Pick the dialect that matches your database.
  3. Copy the formatted query.

Pick the right dialect

Databases write some things differently, such as quoting names and special functions. Choosing MySQL, PostgreSQL, SQL Server or another dialect helps the formatter understand your query correctly.

Keyword case

Many teams write keywords such as SELECT and WHERE in capitals so they stand out from table and column names. You can also choose lowercase or leave them as typed.

Formatting only

The tool changes layout, never the meaning of your query. It does not run the SQL, connect to any database or check that tables exist.

Errors

If the SQL contains something the formatter cannot read, it shows a short message with the position. Try a different dialect if your query uses features special to one database.

Questions

Is my query sent anywhere?

No. Formatting happens in your browser, which matters when queries contain business data.

Can it format several statements?

Yes, separated by semicolons.

Does it support stored procedures?

Oracle PL/SQL and SQL Server T-SQL are supported for common cases.

Will it make my query faster?

No. It only changes how the query looks.