SQL Formatter
Paste messy SQL to beautify, indent and align it — or minify it to a single line. Everything runs locally in your browser.
Formatted SQL will appear here...
About this SQL formatter
A SQL beautifier puts each clause on its own line, indents sub-expressions and (optionally) upper-cases keywords so a query is readable in code review or a migration file. This one tokenises your SQL for standard SQL, MySQL, PostgreSQL, SQLite, SQL Server, Oracle or BigQuery — it never connects to a database and never sends your query anywhere.
Options
- Dialect: picks the keyword set and quoting rules (backticks for MySQL,
[brackets]for SQL Server, etc.) - Indentation: 2 spaces, 4 spaces or a real tab character
- Keyword case: upper-case, lower-case or keep keywords as typed — column names that happen to match a keyword (
name,status,type) are left untouched - Minify: strips comments and collapses whitespace to a one-line query, leaving string literals untouched
- Share: encodes the query in the URL fragment (after
#) so it is never sent to a server