About this tool
Long SQL queries often end up as a single line in log files, ORM output or error messages. The SQL formatter breaks them into clear blocks: every clause such as SELECT, FROM, JOIN, WHERE or GROUP BY starts on its own line, and columns and conditions are indented. This lets you quickly see what a query does – and where an error is.
The tool knows the specifics of many dialects, including PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery and Snowflake. Keywords can be upper- or lowercased and the indentation is adjustable. It also minifies SQL to a single line and removes comments – handy for embedding in code or configuration. Processing happens locally in your browser.
How it works
- Paste your SQL query – multiple statements separated by semicolons work too.
- Choose the matching dialect so specifics like backticks or :: casts are recognized.
- Set the keyword case and indentation.
- Copy the result – or switch to “Minify” to put everything on one line.
Frequently asked questions
Does formatting change my query?
No. Only whitespace, line breaks and – optionally – the case of keywords change. Quoted identifiers, strings and the logic of the query stay the same.
Why does it say the query could not be parsed?
Usually a bracket, comma or quote is missing, or the wrong dialect is selected – e.g. T-SQL syntax with “Standard SQL”. The message names the line and column where the problem was detected.
Does the tool check whether my query is correct?
Only the syntax, as far as needed for formatting. Whether tables and columns exist or the query returns the expected result can only be judged by your database.
Are comments removed when minifying?
Yes, both -- line comments and /* block comments */. Strings stay untouched, even if they contain characters like --. For JSON data, use the JSON Formatter & Validator.