SQL Formatter & Beautifier
Format and beautify SQL online. Supports MySQL, PostgreSQL, SQLite, T-SQL, BigQuery, and more.
About SQL Formatting
Long, complex SQL queries are vastly more readable when laid out across multiple lines with keywords aligned. The SQL Formatter takes a one-line query and produces an indented version with each clause (SELECT, FROM, WHERE, JOIN, GROUP BY, etc.) on its own line, sub-clauses indented, and SQL keywords uppercased — the conventions most teams use in committed code.
How to use
Paste your SQL, choose your dialect (Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL, BigQuery, Snowflake, Redshift, MariaDB), and press Format. Picking the right dialect matters when your query uses dialect-specific syntax like backtick-quoted identifiers (MySQL), double-dollar string literals (PostgreSQL), or square brackets (T-SQL). When in doubt, Standard SQL handles most queries correctly.
Privacy
Formatting runs entirely in your browser. Your queries are never sent to any server.