🗄️ SQL Formatter
Format and beautify SQL queries. Supports MySQL, PostgreSQL, SQL Server, and standard SQL — all in your browser, no upload, instant results.
About the SQL Formatter
This SQL formatter runs entirely in your browser. Paste your SQL query into the input box, choose a SQL dialect, click Format, and the beautified SQL appears in the output box. Nothing is uploaded to a server — formatting happens locally using the well-tested sql-formatter library.
Supported dialects
- Standard SQL — Generic SQL92-compatible formatting for portable queries.
- MySQL — Includes MySQL-specific functions and keywords.
- PostgreSQL — Recognizes PostgreSQL syntax and types.
- SQL Server (T-SQL) — Microsoft's Transact-SQL dialect.
- SQLite — The lightweight embedded SQL dialect.
How to use
- Paste your SQL query in the input box.
- Select the appropriate SQL dialect.
- Click Format to beautify the query.
- Review the result in the output box.
- Click Copy to copy the result, or Clear to start over.
Frequently asked questions
Does this tool upload my SQL? No. All formatting happens locally in your browser. Your queries never leave your device.
What happens if my SQL is invalid? The formatter is lenient and will still attempt to format invalid SQL, but the result may not be perfect. Always validate queries against your database.
Are comments preserved? Yes, both single-line (--) and multi-line (/* */) comments are kept in the output.
Does it support DDL statements? Yes. CREATE, ALTER, DROP, and other DDL statements are formatted alongside DML like SELECT, INSERT, UPDATE, DELETE.