SQL Formatter & Beautifier

Format and beautify SQL queries with proper indentation. Supports MySQL, PostgreSQL, SQLite, T-SQL, and more.

Free Always No Account Needed 100% Client-Side

About this tool

Readable SQL is easier to understand, review, and maintain. Long, unformatted SQL queries (especially from ORM-generated code or query logs) are notoriously hard to read.

This tool reformats SQL queries with: - Keyword uppercasing (SELECT, FROM, WHERE, JOIN, etc.) - Consistent indentation for nested queries and CTEs - Newlines before major clauses - Alignment of column lists and conditions

Supported dialects: - MySQL / MariaDB - PostgreSQL - SQLite - SQL Server (T-SQL) - Oracle (PL/SQL) - BigQuery / Spark SQL (standard SQL)

Paste any SQL — from a single SELECT to complex CTEs with window functions and subqueries — and get cleanly formatted output you can read and understand at a glance.

Frequently Asked Questions

Does this work with stored procedures?
Yes. The formatter handles CREATE PROCEDURE, BEGIN/END blocks, and variable declarations in T-SQL and PL/SQL.
Can it format very long queries?
Yes. There's no size limit — paste queries of any length including multi-page reports with many CTEs.
Does it change my query logic?
No. The formatter only changes whitespace and capitalization — the query logic and result are identical.
What is a CTE?
A Common Table Expression (WITH clause) defines a temporary named result set within a query, making complex queries more readable.

Related Tools