SQL Formatter
Standardise SQL with dialect-aware formatting.
Format SQL online with dialect-aware parsing for PostgreSQL, MySQL, T-SQL, Oracle, BigQuery, Snowflake and more. Control keyword casing (UPPER/lower) and indentation, and format multiple statements at once. Runs fully in your browser — your queries are never uploaded.
How to use SQL Formatter
Paste your SQL
Paste your query or upload a .sql file into this free online SQL formatter to clean up and standardise the SQL instantly in your browser, with nothing uploaded.
Choose your dialect
Select your database dialect such as PostgreSQL, MySQL, T-SQL, Oracle, BigQuery or Snowflake so dialect-specific syntax is parsed and formatted correctly.
Set keyword case
Force SQL keywords like SELECT, FROM and WHERE to UPPERCASE or lowercase, or pick Preserve to keep casing consistent across your whole codebase.
Pick indentation
Indent the formatted SQL with 2 spaces, 4 spaces or tabs so wrapped clauses and aligned lists match your team's preferred house style.
Format instantly
The SQL formatter re-indents and standardises every statement instantly, formatting multiple semicolon-separated queries at once without changing their logic.
Copy or download
Copy the formatted SQL to your clipboard or download it as a tidy .sql file, ready to drop straight back into your editor or migration.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL plus MySQL, PostgreSQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Amazon Redshift, Spark SQL and IBM DB2. Pick the closest match for the most accurate formatting.
Does it execute or change my query's logic?
No. It only reformats the text — whitespace, line breaks and keyword case. The query's logic, identifiers and literals are left exactly as written. Nothing is run against any database.
Can it format more than one statement?
Yes. Separate statements with semicolons and each is formatted independently, with a blank line between them.
How do I format SQL online for free?
Paste your query into this free online SQL formatter, choose your dialect, keyword case and indentation, and it re-indents and standardises the SQL instantly. There's no sign-up, and formatting runs entirely in your browser.
What's the difference between formatting and beautifying SQL?
Both clean up SQL with the same parser. The SQL Formatter gives you direct control over keyword case (UPPERCASE, lowercase or preserve) and indentation to match a house style, while the SQL Beautifier is preset for maximum readability out of the box.
Can the SQL formatter make keywords uppercase or lowercase?
Yes. Use the Keywords option to force SQL keywords like SELECT, FROM and WHERE to UPPERCASE or lowercase, or choose Preserve to leave them as written. This keeps casing consistent across your whole codebase.
Are my queries private?
Completely. Formatting happens in your browser — your SQL is never sent to a server, so it's safe for queries containing schema or business logic.
Can it format a minified or one-line SQL query?
Yes. Paste a cramped, single-line query and the formatter re-indents it into readable, multi-line SQL with each clause on its own line, making a complex SELECT with joins and sub-queries far easier to read and debug.
Will formatting help me spot errors in my SQL?
Often, yes. Re-indenting a query so each clause, join and condition sits on its own line makes missing commas, unbalanced parentheses and misplaced conditions much easier to see — though the formatter only reshapes the text and never runs or changes the query's logic.
Related tools — Formatters & validators
- JSON Formatter — Beautify or minify JSON with live error checking.
- JSON Validator — Validate JSON and pinpoint syntax errors.
- XML Formatter — Pretty-print or minify XML, well-formedness checked.
- XML Validator — Check XML is well-formed and locate errors.
- YAML Formatter — Tidy YAML or convert it to JSON.
- SQL Beautifier — Turn cramped one-line SQL into readable queries.