Back to All Tools

SQL Formatter & Beautifier

Instantly format and beautify SQL queries with configurable keyword casing, indentation style, and dialect-aware parsing. Supports MySQL, PostgreSQL, SQLite, T-SQL, PL/SQL, BigQuery, Snowflake, and 15+ more dialects. Everything runs in your browser.

Supported SQL Dialects

DialectBest For
SQL (Generic)Standard ANSI SQL — works with any database
MySQL / MariaDBLAMP stack, WordPress, web apps
PostgreSQLPostGIS, JSONB, advanced type support
SQLiteEmbedded apps, mobile, local files
T-SQLSQL Server, Azure SQL Database
PL/SQLOracle Database stored procedures
BigQueryGoogle Cloud analytics, data warehousing
SnowflakeCloud data warehouse
RedshiftAWS data warehouse
Spark SQLApache Spark distributed queries
DuckDBAnalytical SQL on local/Parquet files

Formatting Options Explained

  • Keyword Case: UPPERCASE is the traditional SQL convention and the easiest to read at a glance. lowercase is preferred by some teams for consistency with ORM-generated queries. preserve leaves keywords unchanged.
  • Indent Style: Standard indents sub-clauses under the parent keyword. Tabular Left/Right aligns keywords to a column, which some DBAs prefer for wide-screen reading.
  • Tab Width: Most SQL style guides use 2 or 4 spaces. Setting to 4 matches many linter defaults.
  • Lines Between Queries: When pasting multi-statement scripts, this controls how many blank lines to insert between each ;-terminated statement.

Why Format SQL?

  • Code reviews: Consistent formatting makes query intent immediately clear, reducing review time.
  • Debugging: Minified or single-line SQL is nearly impossible to read. Formatting reveals nested subqueries, JOIN conditions, and WHERE clause complexity at a glance.
  • Documentation: Well-formatted SQL embedded in README files or wikis is self-documenting.
  • ORM debugging: ORMs like SQLAlchemy, Hibernate, and ActiveRecord can produce verbose, unformatted SQL — paste the raw query here to understand what's happening.

Frequently Asked Questions

Does this handle stored procedures and DDL?

Yes — CREATE TABLE, ALTER TABLE, CREATE PROCEDURE, and other DDL/DML statements are supported. For PL/SQL blocks with BEGIN…END, select the PL/SQL dialect for best results.

My query has custom functions — will they be preserved?

Custom function calls are treated as identifiers and will be preserved as-is. Only SQL keywords are reformatted by the formatter.

Is my SQL safe?

Absolutely. All formatting is done locally in your browser using the open-source sql-formatter library. No queries are ever transmitted to a server.