Emojar – free online tools

SQL Formatter

Format messy or one-line SQL into readable, consistently indented queries. Supports PostgreSQL, MySQL, SQL Server, SQLite, Oracle, BigQuery, Snowflake and more, with uppercase or lowercase keywords.

This tool runs entirely in your browser.

Loading tool…

How to use the SQL Formatter

  1. 1Paste your SQL.
  2. 2Pick the dialect, keyword case and indentation.
  3. 3Click “Format SQL” and copy the result.

What is the SQL Formatter?

Formatting puts each clause (SELECT, FROM, JOIN, WHERE, GROUP BY…) on its own line and indents nested queries, which makes long queries much easier to review in code reviews and pull requests.

The formatter is the open-source sql-formatter library running in your browser, so queries containing table names or customer data are never sent anywhere.

Frequently asked questions

Does formatting change what the query does?

No. Only whitespace and, if you choose, the case of keywords and literals such as TRUE and NULL change. String literals and identifiers stay exactly as written.

Why does my query fail to format?

Dialect-specific syntax (for example T-SQL brackets or BigQuery backticks) needs the matching dialect. Switch the dialect and try again.

Is the SQL Formatter free and private?

Yes. The SQL Formatter is free, needs no account, and runs entirely in your browser. What you type is never sent to a server or stored.