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.

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

0 lines 0 chars 0 keywords
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

  1. Paste a query and select its SQL dialect. Start with select id from users where active = 1; if you need an example.
  2. Choose indentation and keyword case; decide whether comments should be kept.
  3. Format the query and inspect the result. Correct reported input errors before copying.
  4. Copy or download the SQL. Validate database-specific behavior in your own database environment before running it.