Developer Tools

SQL Formatter

Paste a SQL query to indent and lay it out consistently, across several common database dialects. Runs entirely in your browser.

Why dialect matters

Standard SQL and its various dialects (MySQL, PostgreSQL, T-SQL, PL/SQL, and others) differ in small but real ways — quoting rules, specific keywords, and syntax extensions like T-SQL's TOP or PostgreSQL's LIMIT/OFFSET. Picking the right dialect helps the formatter recognize these correctly rather than misreading them as errors or formatting them oddly.

What this does and doesn't do

This tool reformats whitespace, indentation, and line breaks to make a query easier to read — it doesn't validate that the query is logically correct, check that tables or columns exist, or optimize the query in any way.

Frequently asked questions

Which SQL dialect should I pick?

Pick the database you're actually writing the query for — MySQL, PostgreSQL, SQL Server, PL/SQL (Oracle), SQLite, BigQuery, or Snowflake. If you're not sure or your query uses only common syntax, Standard SQL usually works fine.

Does this validate that my query is correct?

No — it only reformats whitespace and indentation. It doesn't check that tables or columns exist, or that the query's logic is correct.

Is my query sent anywhere?

No — formatting runs entirely in your browser using JavaScript. The query is never sent to a server.

Related tools