No Signup Required

SQL Formatter & Beautifier

Turn one-line or messy SQL into readable, consistently indented queries.

  • Runs in your browser — nothing uploaded
  • Instant, no waiting in a queue
  • Free, no watermark, no daily limits

Paste a SQL query and format it with clear line breaks and indentation for clauses, joins and subqueries, using the open-source sql-formatter library. Choose a dialect — Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark or Trino — so dialect-specific syntax is understood. Set keywords to UPPER, lower or unchanged, pick an indent, or compact a query onto one line while string literals stay untouched.

How to Format a SQL Query

  1. 1

    Pick the dialect

    Choose your database, such as MySQL or PostgreSQL.

  2. 2

    Paste the query

    Paste SQL or open a .sql file, and choose keyword case and indent.

  3. 3

    Format and copy

    Click Format (or One line), then copy or save the result.

Why use ToolzBank SQL Formatter?

  • 12 SQL dialects including MySQL, PostgreSQL and T-SQL
  • UPPER, lower or preserved keyword case
  • 2 spaces, 4 spaces or tab indentation
  • Formats multiple statements at once
  • One-line compact mode that keeps strings intact
  • Open and save .sql files

Frequently asked questions

Does formatting change what my query does?
No. The formatter only changes whitespace, line breaks and (if chosen) keyword case; table names, values and logic stay the same.
Which databases are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL and Trino/Presto.
Why does it say the query could not be parsed?
The query probably uses syntax from a different dialect, or has an unclosed quote or bracket. Try selecting the matching dialect or check the part of the query named in the error message.
Does it validate my SQL?
It parses the query enough to format it, but it does not check table or column names against a database. Run the query to confirm it is valid.
Is my SQL sent to a server?
No. The tool runs entirely in your browser — nothing you paste is sent to a server.

More free developer tools