TF

Developer Tools

SQL Formatter and Beautifier

Format messy SQL into readable queries for PostgreSQL, MySQL, SQL Server, Oracle, BigQuery, and more — or minify it.

Runs locally in your browser — your input is not uploaded.

Paste SQL — it is formatted as you type.

What is this tool?

Paste a long one-line query from your logs or ORM and get readable SQL with consistent indentation and keyword case. Choose your database dialect so its functions, operators, and quoting are understood, or switch to Minify to collapse a query onto one line.

Formatting is powered by the open-source sql-formatter library, which understands dialect-specific syntax such as PostgreSQL casts, T-SQL brackets, and BigQuery backticks.

Minify removes comments and extra whitespace while leaving string literals and quoted identifiers untouched. Your queries are processed in the browser and never sent to a server.

How to use the SQL Formatter

  1. Paste your SQL or load the example.
  2. Choose the dialect: Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, BigQuery, Snowflake, and more.
  3. Set keyword case, indentation, and leading commas to match your style guide.
  4. Copy or download the formatted SQL, or switch to Minify for a single line.

Examples

Beautified query

select id, name from users where active = 1
SELECT
  id,
  name
FROM
  users
WHERE
  active = 1

Frequently asked questions

Does formatting change what my query does?

No. Only whitespace and, if you choose, keyword case change. Identifiers and string values are kept exactly as written.

Why do I get a parse error?

The query may use syntax from another database. Pick the matching dialect — for example T-SQL for [bracketed] names or MySQL for backticks.

Can it format several statements at once?

Yes. Statements separated by semicolons are formatted one after another, with a blank line between them.

Want more power later?

Premium tools, higher limits, and API access are on the roadmap. V1 stays free and private in your browser.