How do I format a SQL query?
Paste the query into the input box and the formatted version appears below it as you type: every clause — SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY — starts a line of its own, the columns and conditions under it are indented one step, and subqueries and CASE expressions are nested a further step in. Copy the result with the button on the output card.
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Amazon Redshift, DuckDB, ClickHouse, Spark SQL, Hive, Trino/Presto, IBM Db2, Db2 for i, TiDB, SingleStore and Couchbase N1QL. Pick the one your query was written for: the dialect decides which quotes, operators, placeholders and keywords are recognised, so PostgreSQL’s :: casts or T-SQL’s [bracketed names] are only understood with their own dialect selected.
Why does my query show an error?
Usually because the dialect does not match. A PostgreSQL cast such as tags::text[], a MySQL # comment or a T-SQL [column name] is not Standard SQL, so the formatter stops at the first character it cannot place and names its line and column. Choose your database in the Dialect list and the same query formats. If it still fails, the error points at a real problem — most often a bracket or a quote that is never closed.
Does the SQL formatter validate my query?
No, and it is worth knowing why. It checks that the text can be split into SQL tokens and laid out as clauses, but it does not know your tables, columns or types, and it accepts many statements a database would reject — a missing FROM, a misspelt column or a GROUP BY that leaves out a selected column all format without complaint. Run the query against the database, or EXPLAIN it, to know it is valid.
How do I minify SQL to a single line?
Choose Minify. Comments are removed, every run of spaces and line breaks becomes a single space, and the spaces beside commas, semicolons and inside brackets go, which is the form that fits in a string literal in code, a log line or a JSON config value. Text inside quotes is never touched, and optimizer hints written as /*+ ... */ or MySQL’s /*! ... */ are kept because the database reads them.
Can I keep my keywords lower case?
Yes. Keyword case offers UPPER, lower and Preserve. The choice covers keywords, function names such as COUNT and COALESCE, and data types such as INT and VARCHAR; table names, column names, aliases and string contents are always left exactly as you wrote them. Preserve leaves keywords as typed and changes only the layout.
Is my SQL sent to a server?
No. The formatter is JavaScript that runs in your browser, so the query — and any table names, customer IDs or literal values inside it — never leaves your machine, is not logged and is not attached to an analytics event. You can confirm it in the browser’s network tab, which stays empty while you work.