About SQL Formatter
SQL Formatter re-indents a query and changes keyword case for the dialect you pick. It uses sql-formatter. It does not connect to a database, and it does not run the statement. If the dialect does not understand the syntax, the error is shown and the query is left unchanged.
How to use SQL Formatter
- Paste a query or load the sample.
- Choose a dialect, keyword case, and indent.
- Select Format.
- Copy or download the result. If formatting fails, read the error and try another dialect.
Examples
A join
Uppercase the keywords in a SELECT with JOIN, WHERE, and ORDER BY so the clauses line up.
A CTE
Format a WITH query, including the INSERT, UPDATE, or DELETE that follows, when the dialect supports it.
Limitations
- Unsupported syntax is reported. It is not silently rewritten into a different statement.
- String literals, quoted identifiers, and comments are preserved only to the extent sql-formatter guarantees for that dialect.
- This tool never executes SQL.
Privacy
This tool processes everything locally in your browser tab. Your input is not uploaded to Utilhex or any third party, and it is discarded when you close or reload the page. Read the privacy policy for details.
Frequently asked questions
Is my input sent anywhere?
No. Processing happens in your browser. Utilhex does not send tool input to its servers, analytics, or any AI service.
Which dialects are supported?
PostgreSQL, MySQL, MariaDB, SQLite, Transact-SQL, PL/SQL, BigQuery, Snowflake, Spark, and DuckDB. Pick the one closest to your database.
Will a string that contains SELECT be changed?
No. Text inside string literals is not treated as a keyword. The formatted query is not executed.