FlowToolkit
Dev

SQL Formatter

Format and prettify SQL for MySQL, Postgres, SQLite, BigQuery, and 7 more dialects.

Loading tool…

About this tool

Paste any SQL and prettify it with consistent indentation and keyword casing. Supports 11 dialects including MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, Redshift, Snowflake, Spark SQL, T-SQL, and PL/SQL. Minify back to one line in a click.

Readable SQL is debuggable SQL

Long SQL queries that span multiple JOINs, subqueries, and CTEs become unreadable when collapsed into a single line. A consistent indentation style with one clause per line, uppercase keywords, and aligned commas turns an opaque blob of text into something a teammate can review in seconds. Most teams agree this is important — yet developers paste a one-liner into chat dozens of times a day.

A formatter solves the problem by enforcing a single style on demand. Paste any SQL and get back a beautifully indented version, ready for a code review comment, a runbook entry, or a saved query in your warehouse.

Supported dialects

  • Standard SQL (the formatter’s baseline)
  • MySQL
  • PostgreSQL
  • SQLite
  • MariaDB
  • BigQuery
  • Amazon Redshift
  • Snowflake
  • Spark SQL
  • T-SQL (Microsoft SQL Server)
  • PL/SQL (Oracle)

Minify mode

When you need the opposite — a compact one-line version of a query for embedding in code or copying into a single-line config — the minify button collapses all whitespace while preserving correctness. Useful when storing canned queries in an environment variable or pasting them into a constrained UI like a webhook payload.

Frequently asked questions

Which SQL dialects are supported?

Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, Amazon Redshift, Snowflake, Spark SQL, T-SQL (Microsoft SQL Server), and PL/SQL (Oracle).

Can I minify SQL too?

Yes. The Minify button collapses whitespace for compact one-line output, useful for embedding queries in code or configuration.

How do I format a SQL query online?

Paste the query into the input area, choose the dialect (or leave the default), and the formatted output appears instantly. Copy or download the result.

How do I uppercase SQL keywords?

Toggle the keyword casing setting. SELECT, FROM, WHERE, JOIN, and other reserved words switch to uppercase while identifiers and string literals remain unchanged.

Does it validate SQL syntax?

No, the formatter is purely cosmetic. Syntactically invalid SQL is reformatted as best as possible but the tool does not flag errors. Use your database client to validate.

Will my SQL queries be uploaded?

No. The formatter runs in your browser using the sql-formatter library. Sensitive queries — production filters, customer identifiers, internal schema names — stay local.