SQL Formatter

Paste a squashed or hard-to-read SQL query and get it back neatly formatted with consistent indentation and line breaks. Choose your database dialect — MySQL, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery and many more — and pick whether keywords are uppercased. Everything runs in your browser.

Your query is formatted locally in your browser and is never uploaded.

How to use SQL Formatter

  1. Paste your SQL query into the box.
  2. Choose your database dialect from the list.
  3. Optionally untick “Uppercase keywords” to keep your casing.
  4. Press “Format”, then copy or download the tidy query.

About this tool

SQL written in one long line is hard to read, review and debug. Proper indentation makes the structure of a query obvious at a glance.

This formatter understands real SQL grammar for each dialect, so it breaks lines in the right places — around SELECT, FROM, JOIN, WHERE and nested parentheses — rather than guessing.

Frequently asked questions

Which databases are supported?
A wide range including MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, DB2, BigQuery, Redshift, Snowflake, Spark SQL, Hive, Trino, ClickHouse and DuckDB.
Does formatting change what my query does?
No. Formatting only changes whitespace and line breaks. The query logic and results are exactly the same.
Why pick a dialect?
Each database has slightly different syntax and reserved words. Choosing the right dialect makes sure the formatter breaks lines correctly for that flavor of SQL.
Will it uppercase my keywords?
By default yes (SELECT, FROM, WHERE…), which is the common convention. Untick the option to keep your original casing.
Is my query kept private?
Yes. Formatting happens entirely in your browser, so even queries against sensitive schemas are safe to paste.

Related tools

Browse all Developer Tools →

How to use Sql Formatter

Paste your code, data, or URL into the Sql Formatter input area. Select the appropriate mode or option, then process. The formatted or converted output appears clearly and can be copied or saved.

Practical benefits

Frequently asked questions

Is this tool free to use?
Yes. Sql Formatter is fully free with no account or subscription required.
Does it upload my files?
No. All processing occurs locally within your browser session.
Can I use this for professional projects?
Yes, the tool is designed for both casual and professional use. Always verify critical outputs.