SQL Formatter

Format and beautify SQL queries instantly online. Clean up minified or messy SQL with proper indentation, keyword capitalisation, and clause alignment.

Used 10.4K times today

How to Use SQL Formatter

  1. 1

    Paste your SQL

    Copy your raw or minified SQL query and paste it into the input area.

  2. 2

    Select dialect (optional)

    Choose your SQL dialect — MySQL, PostgreSQL, T-SQL, or standard SQL — for optimised keyword formatting.

  3. 3

    Format and copy

    Click "Format" to produce a readable, properly indented SQL query, then copy it for use in your IDE or documentation.

Frequently Asked Questions

Does it support stored procedures and CTEs?
Yes. The formatter handles complex SQL including Common Table Expressions (WITH clauses), subqueries, CASE statements, JOINs, and stored procedure syntax for supported dialects.
Which SQL dialects are supported?
The formatter supports standard SQL (ANSI), MySQL, PostgreSQL, Microsoft SQL Server (T-SQL), Oracle PL/SQL, and SQLite syntax conventions.
Does formatting change query behaviour?
No. Formatting only changes whitespace and case. It does not alter the logical structure or execution of the query in any way.

About SQL Formatter

The SQL Formatter transforms messy, one-line, or auto-generated SQL queries into well-structured, readable statements with proper indentation and consistent keyword capitalisation. Readable SQL is easier to debug, review, and maintain — especially in large projects with complex joins, subqueries, and CTEs.

This tool supports multiple SQL dialects including MySQL, PostgreSQL, T-SQL, and Oracle, adapting formatting conventions to match the target database system. It is ideal for formatting queries from ORM output, BI tools, legacy codebases, or when onboarding onto an unfamiliar database schema.

More Developer Tools Tools