Developer tool

SQL formatter

Indent a query so it can be read, in your own browser.

SQL formatter Runs on your device
  • Runs in your browser — your text is never sent anywhere
  • No sign-up, no quotas, free to use as often as you like

How it works

Queries arrive as one long line from logs, ORMs and colleagues, and the first step in understanding one is always to lay it out. Pasting it into a website to do that is how production queries — table names, column names, sometimes literal customer data in a WHERE clause — end up on someone else's server.

Dialects matter

SQL is a family rather than a language. PostgreSQL, MySQL, T-SQL, PL/SQL, BigQuery and Spark each have syntax the others reject, and a formatter using the wrong dialect will either mangle a query or refuse it. Standard SQL suits most ordinary queries; switch if yours uses vendor-specific syntax.

It only formats

Nothing is executed, no database is contacted, and the query's meaning is never changed — only its whitespace and keyword casing. A formatter that altered your query would be a dangerous thing.

Keyword casing

Upper-case keywords against lower-case identifiers is the long-standing convention and makes structure scannable. Preserving what you typed is there for teams whose style guide says otherwise.

Why this runs locally

A query is a description of your schema and often of your data. There is no reason for that to leave your machine to be indented.

FAQ

SQL formatter — questions

Does it run my query?

No. It only reformats the text. No database is ever contacted.

Why was my query rejected?

Probably the wrong dialect. Vendor-specific syntax needs the matching dialect selected.

Does it change what my query does?

No. Only whitespace and keyword casing change.

Is my SQL uploaded?

No. Formatting happens in your browser.