SQL Formatter

Format and beautify SQL for many dialects (MySQL, PostgreSQL, T-SQL and more) — free, with keyword casing and indent options. 100% in your browser.

100% private — runs entirely in your browser. Nothing you enter is uploaded or logged.

100% private — runs in your browser

Formatting only — your SQL is never run, and it’s never uploaded (it’s beautified locally in your browser). Powered by the open-source sql-formatter library.

How to use the SQL Formatter

  1. Paste your SQL.
  2. Pick the dialect and keyword case.
  3. Choose the indentation.
  4. Copy the formatted query.

What you can use it for

  • Beautify messy or minified SQL
  • Standardise keyword casing across a team
  • Make long queries readable for review
  • Format SQL for any major dialect

More free tools

Wrangling code or data?

Format, encode, hash and minify with our free developer tools — 100% in your browser.

Browse all free developer tools →

Frequently asked questions

Which SQL dialects are supported?

Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, SQL Server (T-SQL) and Oracle (PL/SQL).

Does formatting change what my query does?

No — it only reformats whitespace, indentation and keyword case; the SQL logic is unchanged.

Can I uppercase the SQL keywords?

Yes — choose UPPERCASE, lowercase or preserve for keyword casing.

Is my SQL executed or uploaded?

Neither — it's only beautified locally in your browser, so nothing is run or sent to a server.

Can I set the indentation?

Yes — pick 2 spaces, 4 spaces or tabs.