ToolsMaxxing

SQL formatter

Format long SQL queries with clean indentation for your database dialect.

Your files stay on your device

How it works

  1. 1Paste your SQL, or choose Try an example.
  2. 2Pick your dialect so the right keywords are recognised.
  3. 3Choose keyword case and indent width.
  4. 4Copy the formatted query or download it as a .sql file.

What the options do

Format
Puts each clause on its own line and indents joins, conditions and sub-queries.
Minify
Collapses the query to one line. Comments are not removed in this mode.
Dialect
Changes how quoting, parameters and dialect keywords are handled. Pick the database you run the query on.
Keywords
Upper case, lower case, or leave keywords as you typed them.

Privacy

Everything runs in your browser. What you paste is never sent to a server. Queries often contain table names and values you may not want to share, so they stay local.

Questions people ask

Does formatting change what the query does?

No. Only whitespace and the case of keywords change. String contents, identifiers and numbers are untouched.

Why does it report an error on my query?

The parser could not read part of the text, usually an unclosed quote or bracket, or a statement from a different dialect. Try another dialect from the list.

Can it format several statements at once?

Yes. Statements separated by semicolons are formatted one after another with a blank line between them.

Does it validate the query against my schema?

No. It checks the shape of the text, not whether tables or columns exist.

Are placeholders such as $1 or :name safe?

Yes. Positional and named parameters are recognised for the common dialects and left exactly as written.

Related tools