Developer Tools

SQL Formatter

Format and beautify SQL queries with proper indentation and keyword uppercasing.

Runs in your browser

SQL Input
Formatted Output

            

What is the Sql Formatter?

Well-formatted SQL is dramatically easier to read, debug, and maintain than compressed or inconsistently indented queries. The SQL Formatter automatically applies consistent indentation, keyword casing, and line breaks to raw or minified SQL queries, transforming walls of text into clean, structured code. It supports standard SQL as well as dialects like MySQL, PostgreSQL, SQLite, and T-SQL.

How to use the Sql Formatter

  1. Paste your raw or minified SQL query into the input field.
  2. Select the SQL dialect (MySQL, PostgreSQL, T-SQL, etc.) that matches your database.
  3. Choose your preferred keyword case: UPPERCASE, lowercase, or as-is.
  4. Click Format to produce the beautified query.
  5. Copy the result or click Minify to reverse the process and compact the query.

Frequently asked questions

No. Formatting only changes whitespace and keyword casing, which SQL databases ignore. The logical meaning and execution plan of the query remain identical.
The formatter supports standard ANSI SQL and common dialects including MySQL/MariaDB, PostgreSQL, SQLite, Microsoft T-SQL (SQL Server), and Oracle PL/SQL.
Yes. The formatter handles complex SQL including CTEs (WITH clauses), subqueries, window functions, and stored procedure blocks, applying consistent indentation throughout.