Code Beautifier

SQL Formatter

Format messy SQL into readable, consistently indented queries. · Updated

Options
SQL dialect:
Indent size:
Keyword case:
sql
Formatted Outputsql
Draft saved locally.

SQL formatters turn dense queries into reviewable text so joins, filters, and CTEs are obvious at a glance. This tool supports common dialects and keeps processing local so production queries never leave your machine.

Common errors and fixes

syntax error at or near ","

Remove a trailing comma in the SELECT list or VALUES clause.

Why it happens, with a live example

Unclosed quotation mark

Balance single quotes around string literals; escape quotes by doubling them in SQL.

Why it happens, with a live example

Incorrect syntax near ")"

Check for an extra closing parenthesis or a missing expression before it.

Why it happens, with a live example

Invalid column name

Verify identifiers and aliases; dialect options change how identifiers are quoted.

Options

OptionDescription
SQL dialectDialect affects how reserved words, string quoting, and functions are parsed.
Indent sizeNumber of spaces per indent level.
Keyword caseMost SQL style guides use uppercase keywords for readability.

FAQ

Which SQL dialects are supported?

Standard SQL, MySQL, PostgreSQL, SQLite, BigQuery, and SQL Server T-SQL.

Why does my formatted query look different from my team's style?

Adjust indent size and keyword case in the options panel. Settings persist in your browser.

Can I format a stored procedure?

Yes, though procedural extensions like PL/pgSQL are formatted on a best-effort basis.

Is there a size limit?

Files under 5MB format directly in the editor. Larger files are processed in a background worker and offered as a download.