SQL Formatter
Format and beautify SQL queries with dialect-aware rules. Everything runs in your browser, so your queries never leave the page.
About this SQL formatter
This is a free online SQL formatter. Paste any SQL query into the input panel, pick your dialect, and you'll get a clean, indented version in the output panel. The clause structure (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY, ...) is broken across lines so the query is easy to read and review.
Supported dialects
- Standard SQL
- PostgreSQL, MySQL, MariaDB, SQLite
- SQL Server (Transact-SQL), Oracle (PL/SQL)
- BigQuery, Snowflake, Redshift
Options
- Keyword case: UPPER, lower, or preserve the original casing.
- Indent: 2 spaces, 4 spaces, or tab.
- Sample: load a representative query that exercises CTEs, joins, and aggregates.
How it works
The tool uses the open source sql-formatter library, loaded into your browser on first use. Tokenization and reformatting are dialect-aware, so reserved words and quoting rules match the database you select.
Privacy
Your SQL never leaves your browser. The whole tool runs locally as JavaScript on this page, so you can safely paste production queries, schema migrations, or anything else without it touching a server.
Frequently asked questions
Does this tool send my SQL anywhere?
sql-formatter library is fetched once from a public CDN, but your query text is never uploaded.Does it validate or execute the SQL?
Why does my query look different after formatting?
Can I keep my original keyword casing?
select, SELECT, and Select exactly as written.