SQL Formatter
Format messy SQL into readable, consistently indented queries. · Updated
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
Remove a trailing comma in the SELECT list or VALUES clause.
Why it happens, with a live exampleBalance single quotes around string literals; escape quotes by doubling them in SQL.
Why it happens, with a live exampleCheck for an extra closing parenthesis or a missing expression before it.
Why it happens, with a live exampleInvalid column name
Verify identifiers and aliases; dialect options change how identifiers are quoted.
Options
| Option | Description |
|---|---|
| SQL dialect | Dialect affects how reserved words, string quoting, and functions are parsed. |
| Indent size | Number of spaces per indent level. |
| Keyword case | Most 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.