Skip to content
Q

SQL Formatter

Format and beautify SQL queries with dialect support.

Last updated:

Processed locally — your files are not uploaded to any server.

About the SQL Formatter

Queries arrive badly wrapped — pasted from a log, generated by an ORM, or grown one clause at a time until nobody can see the structure. This tokenises the query and lays it out again with keywords, clauses and nesting on predictable lines, so the shape of a join or a subquery becomes visible at a glance. Pick the dialect closest to your database and the quoting conventions follow. It is a formatter and nothing more: your logic is never rewritten, so the formatted query returns exactly what the original did, which is what makes it safe to run on something you are about to execute in production. The corollary is that formatting is not validation — a query with a genuine syntax error will still come back neatly indented. Choosing the wrong dialect usually still produces working SQL, just with odd spacing around dialect-specific keywords.

How to use it

  1. Paste a query, however badly wrapped.
  2. Pick the dialect closest to your database.
  3. Format, then copy the result.

Things worth knowing

  • Formatting is not validation. A query with a genuine syntax error will still be laid out neatly.
  • Dialect choice matters for things like backtick quoting and dialect-specific keywords; the wrong one usually still works but spaces things oddly.