SQLFormatter
FormatterConvertPricingDocsGet Pro

SQL formatting docs

A short reference on formatting SQL for readability: what the formatter does, how each dialect differs, and what the options change. Formatting runs entirely in your browser — paste a query and format it, no sign-up.

Open the formatter

What SQL formatting does

A formatter parses your query against a dialect’s grammar and rewrites it with consistent indentation, aligned clauses and normalised keyword casing. It doesn’t change what the query does — only how it reads. That’s the difference from a plain “beautifier” that only pushes whitespace around: a grammar-aware formatter understands JSONB operators, bracketed identifiers or STRUCT literals and keeps them intact.

Formatters by dialect

Format PostgreSQL
JSONB operators, :: casts, ILIKE and RETURNING.
Format MySQL
Backtick identifiers, GROUP_CONCAT, LIMIT/OFFSET.
Format T-SQL
TOP, [bracketed] names, ISNULL — SSMS-ready.
Format SQLite
Flexible typing, strftime, json_extract.
Format BigQuery
STRUCT/ARRAY, backtick project.dataset.table.
Format Oracle
ROWNUM, NVL, || concatenation, TO_CHAR/TO_DATE.
Format Snowflake
VARIANT colon-paths, QUALIFY, :: casts, FLATTEN.
Format Redshift
LISTAGG, DATEADD/GETDATE, distribution-aware SQL.

Beautifiers by dialect

Turn minified, single-line SQL back into readable, indented queries — per dialect.

Beautify PostgreSQLBeautify MySQLBeautify T-SQLBeautify SQLiteBeautify BigQueryBeautify OracleBeautify SnowflakeBeautify Redshift

Convert between dialects

A formatter re-indents; it won’t rewrite TOP into LIMIT or NVL into COALESCE. The AI converter translates queries between dialects — each guide shows exactly what changes.

OraclePostgreSQLT-SQLPostgreSQLMySQLPostgreSQLPostgreSQLMySQLMySQLT-SQLT-SQLMySQLPostgreSQLT-SQLOracleMySQLOracleSnowflakeT-SQLSnowflakeAll conversions →

SQL tools

Explain a SQL query
Plain-English breakdown of what any query does.
Optimize a SQL query
Indexes and rewrites to speed up a slow query.
SQL minifier
Strip comments and collapse SQL to a single line.
SQL validator
Check syntax against a dialect, with line/col errors.

Formatting options explained

Keyword case

Force keywords like SELECT, FROM, WHERE to UPPER, lower, or leave them as-is. Uppercase is the convention most teams review in.

Indent width

How many spaces each nesting level adds. 2 spaces is compact; 4 is easier to scan in deeply nested queries.

Line length

The formatter wraps long SELECT lists and conditions once a line passes this width, so nothing runs off the screen.