How to use it
Paste your SQL into the input box and it’s broken onto separate, indented lines by clause (SELECT, FROM, WHERE, JOIN, and so on) so it’s easy to read. Pick the database you’re using under Language, and adjust keyword case (upper, lower, or as typed), indent width (2 spaces, 4 spaces, or a tab), and the number of blank lines between queries to your taste. Paste several queries separated by semicolons (;) and each one gets formatted.
Dialects have different syntax
SQL has a standard, but real databases each bend the syntax a little differently. BigQuery, for instance, wraps table names in backticks (`), while T-SQL (SQL Server) has its own TOP N clause and square-bracketed identifiers. Picking the wrong dialect can make an otherwise valid query fail to parse, so it’s worth choosing, under Language, the dialect that matches the DBMS you actually use: Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (SQL Server), or BigQuery.
When something goes wrong
If the SQL you pasted can’t be parsed by the formatting engine’s grammar, you’ll get an error message instead of a result. When the library can tell where it got stuck, the line and column are shown too — check around that spot for an unclosed parenthesis or syntax the chosen dialect doesn’t support.
Why there’s no “minify” option
This tool only pretty-prints; it doesn’t offer a way to collapse everything onto one line. Safely removing whitespace without touching what’s inside string literals or comments requires fully parsing the SQL, and the library it uses (sql-formatter) doesn’t have that feature — building a naive version ourselves would risk mangling string contents. If you want a more compact result, try a narrower indent width and set the blank lines between queries to zero instead.
Privacy
The SQL you paste is processed entirely in this browser tab and is never stored or transmitted anywhere. The formatting engine (sql-formatter) is only downloaded by your browser when needed and runs locally — it never sends your query anywhere.