SQL Formatter

Format and beautify SQL queries

  

Free SQL formatter & beautifier — 12 dialects

Toololis SQL Formatter formats messy SQL into readable, consistent code. Supports 12 dialects — PostgreSQL, MySQL, MSSQL, SQLite, BigQuery, Oracle PL/SQL, and more. Keyword case and indentation configurable.

How to use this tool

  1. 1

    Paste SQL query

    Minified or messy — we handle any SQL.

  2. 2

    Choose dialect

    PostgreSQL, MySQL, MSSQL, SQLite, BigQuery, or plain SQL. Each has slight syntax differences.

  3. 3

    Format instantly

    Keywords uppercased, indentation normalized, line breaks added. Copy the result.

Supported SQL dialects

  • PostgreSQL — open-source, most feature-complete
  • MySQL / MariaDB — most popular OSS databases
  • SQL Server (T-SQL) — Microsoft enterprise DB
  • SQLite — embedded, widely used
  • BigQuery — Google Cloud analytics
  • Redshift — AWS data warehouse
  • Snowflake — cloud data platform
  • Oracle PL/SQL — enterprise SQL
  • DB2 — IBM database
  • Spark SQL — Apache Spark analytics

Frequently Asked Questions

What SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQL Server (MSSQL / Transact-SQL), SQLite, BigQuery, Redshift, Snowflake, Db2, PL/SQL (Oracle), and Spark SQL.
What formatting rules are applied?
Keywords UPPERCASED, consistent indentation (2 or 4 spaces), line breaks before major clauses (SELECT, FROM, WHERE, JOIN), and aligned operators.
Does it validate SQL syntax?
No — formatting is cosmetic. It assumes input is valid SQL. Invalid SQL may produce unexpected output.
Can I format stored procedures?
Yes, and CTEs (WITH ... AS), window functions (OVER PARTITION BY), and JSON operators all format correctly.
Is my query sent to a server?
No. We use the sql-formatter JavaScript library, running entirely in your browser. Safe for production queries with sensitive schema names.

You might also like

🔒
100% Privacy. This tool runs entirely in your browser. Your data is never uploaded to any server.