SQL Formatter
Format SQL for MySQL, PostgreSQL, SQL Server, Oracle, SQLite, MariaDB or BigQuery. Set indentation and keyword case, then copy or download the query.
Format SQL for MySQL, PostgreSQL, SQL Server, Oracle, SQLite, MariaDB or BigQuery. Set indentation and keyword case, then copy or download the query.
- Prepare your input
Choose the relevant options using the controls below.
- Run your task
Adjust the controls below and inspect the preview.
- Use the result
Check the result, then use the available copy or download controls.
Scope and limits
Formats SQL clauses and indentation locally. Limit: 100,000 characters and 128 nesting levels. Quote/comment checks do not validate database grammar or schemas. No execution or stored-procedure support.
SQL Input
Settings
Formatted Output
Formatted Output
SQL Formatter
Format a SQL query for code review or debugging by separating clauses and applying consistent indentation. Choose the dialect that matches the query: MySQL, PostgreSQL, SQL Server, Oracle, SQLite, MariaDB or BigQuery. For example, select id from users where active = 1; becomes easier to scan when SELECT, FROM and WHERE start separate clauses.
Formatting changes presentation; it does not execute the query or optimize its execution plan. Quote and comment checks do not establish that a database will accept the query or that referenced tables exist. Input is limited to 100,000 characters and 128 nesting levels; stored procedures are outside this tool’s supported scope.
Features
- Format SQL using one of seven supported dialects.
- Choose spaces or tabs and uppercase, lowercase or preserved keyword case.
- Keep comments or use the comment-removal option.
- Copy or download formatted SQL; inspect quote and comment errors separately.
How to use
- Paste a query and select its SQL dialect. Start with select id from users where active = 1; if you need an example.
- Choose indentation and keyword case; decide whether comments should be kept.
- Format the query and inspect the result. Correct reported input errors before copying.
- Copy or download the SQL. Validate database-specific behavior in your own database environment before running it.