SQL formatter
Paste a query, pick your database, and get clean, readable SQL: one clause per line, consistent keyword case and indentation. It understands the syntax of each database and runs entirely in your browser.
Runs in your browser. Your SQL is never sent anywhere.
How to use it
- 1Paste your SQL in the input box, or load the example.
- 2Pick the dialect of your database so quoting and keywords are read correctly.
- 3Choose keyword case and indentation. The result updates as you type.
- 4Copy the formatted SQL, or use it as the input for another pass.
Frequently asked questions
Is my SQL sent to a server?
No. The formatter runs in your browser, so queries with table names, customer data or credentials never leave your machine.
Which databases does it support?
PostgreSQL, MySQL, MariaDB, SQL Server (T-SQL), Oracle (PL/SQL), SQLite and standard SQL. Pick the one you use so quoting, operators and keywords are formatted correctly.
Does formatting change what my query does?
No. Only whitespace and the case of keywords change. Strings, names and comments are kept exactly as written.
Can I format several statements at once?
Yes. Separate them with semicolons and each statement is formatted on its own, with a blank line between them.
Can Spectre format SQL for me?
Yes. Spectre has a SQL editor with dialect-aware formatting, and its AI assistant can also explain, fix and optimize queries against your real schema.
More free SQL tools
Do it on your real database with Spectre
Spectre is the AI database studio for PostgreSQL, MySQL and SQL Server. Ask in plain language, get SQL and answers backed by your data, and keep it all on your machine.