SQL Formatter: Beautify SQL Queries Online
Turn long one-line SQL into a readable query with each clause on its own line.
- Works on your device. Nothing is uploaded.
- Free, no watermark
- No signup
How to use
- Paste a SQL query or open a .sql file.
- Pick your database dialect, keyword case and indent.
- Copy or download the formatted SQL.
Good to know
The tool uses sql-formatter (MIT licence). It puts SELECT, FROM, WHERE, GROUP BY and other clauses on new lines, lists one column per line and indents joins and sub-queries. Strings, comments and identifiers are left as written.
Choose the dialect that matches your database: each one knows its own keywords and quoting, such as backticks in MySQL or square brackets in SQL Server. If formatting fails, the message shows where the parser got stuck; often the wrong dialect is selected.
Formatting never runs your query and never connects to a database, so it is safe for queries that contain real table names. Remove passwords or customer data before sharing a query with anyone.
Questions
Which databases are supported?
Standard SQL, MySQL/MariaDB, PostgreSQL, SQL Server (T-SQL), Oracle PL/SQL, SQLite and BigQuery.
Does it fix SQL errors?
No. It formats valid SQL and reports where it could not read the query.
Can I keep lowercase keywords?
Yes, choose "lower" or "As typed".
Can it format many queries at once?
Yes, separate them with semicolons.
Is my query sent to a server?
No. Formatting happens in your browser.