SQLSQL Formatter
Loading...
SQL queries often vary in style between authors, and auto-generated queries can be hard to read. The SQL Formatter formats SQL queries into a consistent style for better readability. It supports 13+ SQL dialects including MySQL, PostgreSQL, Oracle (PL/SQL), and SQL Server (T-SQL), with configurable indentation and keyword casing.
How to Use
- 1Enter SQL
Paste the SQL query you want to format in the left input area.
- 2Configure Options
Select the SQL dialect, indentation (2 spaces/4 spaces/tab), and keyword case (UPPER/lower/preserve).
- 3Review Results
View the formatted SQL in the right panel and use the copy button to copy it to your clipboard.
Tips
- 💡Setting keywords to UPPER makes SELECT, FROM, WHERE, etc. stand out for better readability.
- 💡Complex queries with subqueries and JOINs are automatically indented for clarity.
- 💡Select the dialect matching your database for accurate formatting of dialect-specific syntax.
- 💡All processing happens in your browser, so sensitive queries are never sent to a server.
FAQ
- Q. Which database dialects does the formatter support?
- A. The tool supports MySQL, PostgreSQL, Microsoft SQL Server, Oracle, SQLite, and others. Select the appropriate dialect to ensure keywords and quoting conventions are formatted correctly.
- Q. Does formatting affect how the query runs?
- A. No. Formatting only adjusts whitespace, indentation, and line breaks. The query logic and execution result remain exactly the same.
- Q. Can it format complex queries with CTEs and subqueries?
- A. Yes. JOINs, subqueries, CTEs (WITH clauses), and stored procedures are all handled. Make sure to select the matching dialect if you use database-specific syntax.