SQL formatter

Paste a query to make it readable: clauses on their own lines, consistent indentation, and keywords in the case you choose. Minify puts it back on one line.

14 SQL dialects

Choose the dialect of your database:

  • Standard SQL
  • PostgreSQL
  • MySQL
  • MariaDB
  • SQL Server (T-SQL)
  • SQLite
  • Oracle (PL/SQL)
  • BigQuery
  • Snowflake
  • Amazon Redshift
  • Spark SQL
  • Trino / Presto
  • DuckDB
  • IBM Db2

Wherever the query comes from

Paste SQL from your code, a log, an ORM's debug output or a reporting tool: a query on one line comes back with each clause on its own line, and subqueries and common table expressions indented under the query they belong to. Several statements separated by ; are formatted one after another.

Keyword case

Write keywords in UPPERCASE, in lowercase, or keep them as written.

Minify without breaking anything

Minify removes comments and line breaks, but leaves strings, quoted names and optimizer hints untouched.

Keyboard shortcuts

  • Format: Shift+Alt+F (⌥⇧F on a Mac)
  • Minify: Shift+Alt+M (⌥⇧M on a Mac)
  • Undo: Ctrl+Z (⌘Z on a Mac). Each Format or Minify is a step of its own.
  • Find and replace: Ctrl+F (⌘F on a Mac)

Private: nothing is uploaded

Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.

With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.

Questions

Which SQL dialects are supported?

Standard SQL, PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, Oracle PL/SQL, BigQuery, Snowflake, Amazon Redshift, Spark SQL, Trino / Presto, DuckDB and IBM Db2.

Does formatting change my query?

Only its layout and, if you choose, the case of its keywords. What the query does stays the same.

Is my data uploaded anywhere?

Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.

More tools