SQL Formatter & Beautifier
Format and beautify SQL for 10 dialects including PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, and T-SQL. Uppercase keywords, custom indent.
How to use
- 1Paste your SQL
Any query — SELECT, DDL, procedures. Even one-liners get broken across lines.
- 2Pick your dialect
PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, T-SQL, and more. Affects keyword recognition and quirks.
- 3Tune indent + case
2 or 4 spaces, uppercase or lowercase keywords — match your team's style guide.
- 4Copy the formatted query
Drop it into a pull request, a runbook, or a code review comment.
Examples
select u.name,count(*) as n from users u join orders o on o.uid=u.id where o.total>100 group by u.name order by n desc limit 10
SELECT u.name, count(*) AS n FROM users u JOIN orders o ON o.uid = u.id WHERE o.total > 100 GROUP BY u.name ORDER BY n DESC LIMIT 10
select user_id, tag from users, unnest(tags) as tag where created_at > "2026-01-01"
SELECT user_id, tag FROM users, unnest(tags) AS tag WHERE created_at > "2026-01-01"
Frequently asked
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Redshift, Snowflake, T-SQL (SQL Server), and DB2. Pick the right one — it affects keyword recognition and specific syntax.
Only lightly — enough to format. For proper validation, run the query against your database or use its EXPLAIN command.
No. Formatting runs in your browser via the sql-formatter library. Nothing leaves your device.
Related tools
- JSON FormatterFormat, validate, and minify JSON in your browser. See parse errors with line/co
- Regex TesterTest JavaScript regular expressions against any string with live match highlight
- .env File ParserParse a .env file and see it as a JSON object. Handles comments, quoted values,
- Base ConverterConvert numbers between binary, octal, decimal, and hexadecimal. Supports huge n
- Credit Card ValidatorValidate credit card numbers with the Luhn algorithm and detect the brand: Visa,
- Cron BuilderPick a preset or enter your own fields to build a cron expression. Includes a pl