Free SQL Formatter Online
Format messy SQL with proper indentation and keyword capitalization.
Input SQL
Formatted SQL
Formatted SQL will appear here...
How to use SQL Formatter
Choose your database dialect (e.g., PostgreSQL, MySQL, BigQuery) from the options.
Paste your raw, unformatted SQL query into the input box.
Click the 'Format SQL' button to instantly beautify the query, then click Copy.
How it works
Uses the sql-formatter library to parse and reformat SQL queries with proper indentation, keyword capitalization, and consistent spacing. Supports MySQL, PostgreSQL, SQLite, T-SQL, and BigQuery dialects. The formatter tokenizes your query, builds an Abstract Syntax Tree (AST), and outputs clean, readable SQL. Everything runs completely in your browser.
Why use it
- Supports multiple dialects (Postgres, MySQL, SQLite, T-SQL, BigQuery)
- Automatically uppercases SQL keywords
- Adds standard 2-space indentation and line breaks
- 100% private — your queries never leave your browser
Questions
Is this SQL formatter free?
Yes. It is free with no signup or limits.
Which SQL dialects are supported?
The formatter supports Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (SQL Server), and Google BigQuery dialects.
Are my SQL queries saved on a server?
No. Formatting happens locally in your browser. Your queries and schema names are not uploaded.
What formatting rules are applied?
It adds consistent indentation, standard spacing, line breaks for major clauses, and uppercases SQL keywords.
Can it format large queries?
Yes, but extremely large files depend on your browser memory.
Does it work offline?
Yes. After the formatter loads once, it works without internet.