About SQL Formatter
Turn a long one-line SQL query into something you can read. Paste your SQL and it is laid out with each clause on its own line, tidy indentation and keywords in the case you choose. It knows the details of PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery and other dialects. It all happens in your browser and your queries are never uploaded.
How to use SQL Formatter
- Paste your SQL, press Open file, or press Sample.
- Choose your SQL dialect, the indentation and the keyword case.
- Read the formatted result. It updates as you type.
- Press Copy or Download.
Tips and good to know
- Pick the dialect that matches your database. Quoting rules and special syntax differ, and the wrong one can give an error or odd layout.
- Several statements separated by semicolons are formatted one after another.
- Formatting only changes spaces and line breaks (and keyword case if you ask). The query runs the same way.
- Keep passwords, tokens and private data out of the queries you paste anywhere, even when a tool works locally.
- If you get an error, check for an unclosed quote or bracket first.
Readable SQL
Consistent formatting makes queries easier to review: keywords in capitals, one clause per line (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY) and indented conditions. Formatting never changes what a query does. When reviewing, check joins and WHERE conditions first, since missing join conditions cause accidental row multiplication.
Frequently asked questions
Is my SQL uploaded?
No. It is formatted in your browser.
Does it check that my query is correct?
No. It only checks that it can read the text. It does not know your tables or run anything.
Why does a certain keyword not change case?
Names of tables and columns are never changed, only SQL keywords.
Which databases are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, BigQuery, Snowflake, Redshift and Spark.
Can it minify SQL?
Not at the moment. It only makes SQL easier to read.
Is SQL Formatter free?
Yes. SQL Formatter is 100% free: no sign-up, no paid plan, no trial and no limit on how often you use it. It runs in your browser, and ToolzAura is paid for by ads, so every tool stays free.
Are my files uploaded?
No. This tool runs in your browser, so your input stays on your device.